Muniza-Nabeel/full-stack-todo-app
0
๐ Todo Full-Stack Web Application - Backend API
A RESTful API for multi-user task management with JWT authentication.
๐ Features
- โ User authentication (register, login, logout)
- โ JWT-based authorization (7-day expiry)
- โ CRUD operations for tasks
- โ User-scoped task isolation
- โ PostgreSQL database with migrations
- โ FastAPI with automatic OpenAPI docs
๐ ๏ธ Tech Stack
- Framework: FastAPI 0.109.0
- ORM: SQLModel 0.0.14
- Database: PostgreSQL (Neon Serverless)
- Authentication: JWT (python-jose)
- Migration: Alembic 1.13.1
๐ก API Endpoints
Authentication
POST /api/auth/register- Register new userPOST /api/auth/login- Login userPOST /api/auth/logout- Logout userGET /api/auth/me- Get current user
Tasks
GET /api/{user_id}/tasks- List user tasksPOST /api/{user_id}/tasks- Create taskGET /api/{user_id}/tasks/{task_id}- Get taskPUT /api/{user_id}/tasks/{task_id}- Update taskDELETE /api/{user_id}/tasks/{task_id}- Delete taskPATCH /api/{user_id}/tasks/{task_id}/complete- Toggle complete
๐ง Environment Variables
Required environment variables (set in Hugging Face Space settings):
DATABASE_URL=postgresql+asyncpg://user:password@host/db?sslmode=require
BETTER_AUTH_SECRET=your-secret-key-min-32-characters
ALLOWED_ORIGINS=https://your-frontend.vercel.app,http://localhost:3000
DEBUG=false๐ API Documentation
Once deployed, visit:
- Swagger UI:
https://your-space.hf.space/docs - ReDoc:
https://your-space.hf.space/redoc
๐ฅ Health Check
GET /health - Returns {"status": "healthy"}
๐ Frontend Integration
This backend is designed to work with the Next.js 14+ frontend.
Update your frontend environment variable:
NEXT_PUBLIC_API_URL=https://your-space.hf.space๐ License
MIT License
๐จโ๐ป Developer
Built with FastAPI and deployed on Hugging Face Spaces ๐ค
