A RESTful API built with FastAPI for managing tasks, projects, and user collaboration. Features JWT authentication, PostgreSQL database, and comprehensive API documentation.
pip install -r requirements.txt
Create a .env file in the root directory:
DATABASE_URL=postgresql://user:password@localhost:5432/taskdb
SECRET_KEY=your-secret-key-here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
# Initialize database
python init_db.py
python main.py
The API will be available at http://localhost:8000
http://localhost:8000/docshttp://localhost:8000/redocPOST /auth/register - Register new userPOST /auth/login - Login and get access tokenGET /auth/me - Get current user infoGET /tasks - List all tasksGET /tasks/{id} - Get specific taskPOST /tasks - Create new taskPUT /tasks/{id} - Update taskDELETE /tasks/{id} - Delete taskPATCH /tasks/{id}/status - Update task statusGET /projects - List all projectsGET /projects/{id} - Get specific projectPOST /projects - Create new projectPUT /projects/{id} - Update projectDELETE /projects/{id} - Delete projectGET /users - List all users (admin only)GET /users/{id} - Get specific userPUT /users/{id} - Update userDELETE /users/{id} - Delete usercurl -X POST "http://localhost:8000/auth/register" \
-H "Content-Type: application/json" \
-d '{"username": "john", "email": "john@example.com", "password": "secret123"}'
curl -X POST "http://localhost:8000/tasks" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"title": "Complete API", "description": "Finish the API implementation", "priority": "high"}'
main.py - Application entry pointinit_db.py - Database initializationapp/ - Application code
api/ - API routesmodels/ - Database modelsschemas/ - Pydantic schemascore/ - Core functionality (auth, config)db/ - Database configurationpytest tests/