SafeCity is a civic tech platform designed to empower citizens to report urban infrastructure issues and enable government authorities to address them efficiently.
# Safe City API
Safe City is a Django REST Framework-based backend system designed to enhance city safety through user-generated reports and notifications. It provides endpoints for managing reports, user registration, notifications, and analytics.
## Features
- User registration and authentication
- Report creation, retrieval, updating, and deletion
- Notification system for unread alerts
- Analytics for user activity tracking
## Technologies Used
- Django & Django REST Framework
- PostgreSQL (or any preferred database)
- Django Filters for search functionality
- JWT-based authentication
- Docker (optional for containerization)
## Installation
1. **Clone the repository**
- git clone `git@github.com:G-Gakii/Safe-city-africa-agility.git`
- cd Safe-city-africa-agility
2. Set up the virtual environment:`python -m venv env`
3. activate virtial environment : `source env/bin/activate` # On Windows: `env\Scripts\activate`
4. Install dependencies:`pip install -r requirements.txt`
5. Set up environment variables:
- Create a `.env` file in the project root.
- Add the following variables inside the `.env` file:
1. `SECRET_KEY="your-secret-key"`
6. Run migrations: `python manage.py migrate`
7. Create a superuser : `python manage.py createsuperuser`
8. Run the server: `python manage.py runserver`
## API Endpoints
### User Management
- `GET /api/user/register/` Retrieve all registered users
- `POST /api/user/register/` Register a new user
- `POST /api/user/login/` Obtain authentication token
- `GET /api/user/users/ /` Retrieve user details
- `PUT /api/user/users/ /` Update user details
- `DELETE /api/user/users/ /` Delete a user
### Reports
- `GET /api/report/` List all reports
- `POST /api/report/` Create a new report
- `GET /api/report/report/ /` Retrieve a specific report
- `PUT /api/report/report/ /` Update a report
- `DELETE /api/report/report/ /` Delete a report
### Notifications
- `GET /api/notifications/recent/` Retrieve recent unread notifications
- `GET …