git clone https://github.com/yourusername/vellorun-backend.git
cd vellorun-backend
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- Run Migrations
python manage.py migrate
- Create Superuser (for adding new places)
python manage.py createsuperuser
- Start the Server
python manage.py runserver
creates a new account if user does not exist otherwise signs in automatically if user exists
curl -X POST https://vellorun-backend.vercel.app/api/auth/google/ \
-H "Content-Type: application/json" \
-d '{
"id_token": "GOOGLE_ID_TOKEN"
}'
Response
{
"access": "JWT_ACCESS_TOKEN",
"refresh": "JWT_REFRESH_TOKEN"
}
curl -X POST https://vellorun-backend.vercel.app/api/token/refresh/ \
-H "Content-Type: application/json" \
-d '{"refresh": "<REFRESH_TOKEN>"}'
Response
{
"access":<ACCESS_TOKEN>
"refresh":<REFRESH_TOKEN>
}
curl -X GET https://vellorun-backend.vercel.app/api/user/profile/ \
-H "Authorization: Bearer <ACCESS_TOKEN>"
Response
{
"username": "vellorun",
"email": "[email protected]",
"avatar": 2,
"xp": 20,
"badges":['nerd', 'jock'],
"level": 1,
"visible": true,
"online": true,
"coord_x": 0.0,
"coord_y": 0.0,
}
you can modify coordinates, visibility, username, avatar and online status
curl -X PATCH https://vellorun-backend.vercel.app/api/user/profile/ \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"visible": false}'
curl -X GET http://localhost:8000/api/user/online/
Response
[
{
"username": "vellorun",
"email": "[email protected]",
"avatar": "avatar3",
"xp": 20,
"badges":['nerd', 'jock'],
"level": 1,
"visible": true,
"online": true,
"coord_x": 0.0,
"coord_y": 0.0,
},
...
]
curl -X GET http://localhost:8000/api/places/visited/ \
-H "Authorization: Bearer <ACCESS_TOKEN>"
curl -X GET http://localhost:8000/api/places/contributed/ \
-H "Authorization: Bearer <ACCESS_TOKEN>"
curl -X POST https://vellorun-backend.vercel.app/api/places/saved/ \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"place_id": 1}'
curl -X DELETE https://vellorun-backend.vercel.app/api/places/saved/ \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"place_id": 1}'
curl -X GET https://vellorun-backend.vercel.app/api/places/saved/ \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
curl -X GET http://localhost:8000/api/suggestions/ \
-H "Authorization: Bearer <ACCESS_TOKEN>"
requests for superusers are approved automatically, when users try to add a place it is not shown in searches until its approved.
curl -X POST https://vellorun-backend.vercel.app/api/places/ \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"name": "Sample Place",
"type": "inside",
"description": "Test description",
"coord_x": 12.3456,
"coord_y": 78.9012,
"level": 1,
"xp_reward": 20,
"tags": ["hotel", "top10"],
"images": [
{ "image_url": "https://example.com/img1.jpg" },
{ "image_url": "https://example.com/img2.jpg" }
]
}'
curl -X POST https://vellorun-backend.vercel.app/api/places/<place_id>/approve/ \
-H "Authorization: Bearer <ACCESS_TOKEN>"
curl -X GET https://vellorun-backend.vercel.app/api/places/
Response
[
{
"id": 1,
"name": "Library",
"type": "inside",
"description": "Main campus library",
"coord_x": 25.123,
"coord_y": 85.456,
"visits": 1,
"level": 1,
"xp_reward": 20,
"tags": ["campusbuilding", "quiet"],
"images": []
},
{
"id": 2,
"name": "Taara maa",
"type": "outside",
"description": "A restraunt",
"coord_x": 22.123,
"coord_y": 83.456,
"visits": 101,
"level": 1,
"xp_reward": 20,
"tags": ["hotel", "top10"],
"images": []
}
]
curl -X GET "https://vellorun-backend.vercel.app/api/places/?type=inside"
Response
[
{
"id": 1,
"name": "Library",
"type": "inside",
"description": "Main campus library",
"coord_x": 25.123,
"coord_y": 85.456,
"visits": 1,
"level": 0,
"images": []
}
]
Filter Examples
- id of a place: ?id=1
- Inside places: ?type=inside
- tags: ?tags=top10&tags=hotel
- With >= 100 visits: ?visits__gte=100
- With <= 100 visits: ?visits__lte=100
- Name contains “lib”: ?name__icontains=lib
- Combine filters: ?type=inside&visits__gte=10
- level: ?level__gte=100, ?level__lte=100, ?level=10
curl -X POST https://vellorun-backend.vercel.app/api/visit/ \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{"place_id": 2}'
curl -X GET https://vellorun-backend.vercel.app/api/user/leaderboard/
curl -X GET https://vellorun-backend.vercel.app/api/places/leaderboard/