A secure, async backend service for submitting and moderating user feedback. Built with FastAPI, SQLAlchemy, and JWT authentication. Ready for production with Docker support.
- 🧾 Users can register and log in (JWT-based)
- ✍️ Submit feedback tied to logged-in users
- ✅ Admin can approve/reject feedback
- 🔐 Role-based access control (user/admin)
- 📜 View only approved feedback publicly
- 🧠 Fully async using SQLAlchemy 2.0
- 🐳 Dockerized with environment configs
- 📁 Logs with automatic cleanup
| Endpoint | Method | Access | Description |
|---|---|---|---|
/auth/register |
POST | Public | Register a new user |
/auth/login |
POST | Public | Login and receive JWT token |
/feedback |
POST | Auth (user) | Submit feedback |
/feedback |
GET | Public | View approved feedback |
/feedback/admin |
GET | Admin only | View all feedback (moderation) |
/feedback/admin/{id} |
PUT | Admin only | Approve/reject feedback |
All protected routes require:
Authorization: Bearer <your_token>
git clone https://github.com/raquib-dev/feedback-api-fastapi.git
cd feedback-api-fastapiEdit .env:
SECRET_KEY=your_super_secret_key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30docker compose up --buildThe API will be live at: http://localhost:8000
- FastAPI
- SQLAlchemy (async)
- SQLite / PostgreSQL
- JWT (via python-jose)
- passlib (bcrypt)
- Docker & Compose
app/
├── main.py # App entrypoint
├── auth.py # Auth + JWT logic
├── database.py # DB setup
├── models.py # ORM models
├── schemas.py # Pydantic validation
├── routes/ # Route modules
│ ├── users.py # Auth routes
│ └── feedback.py # Feedback routes
├── logger.py # Central logging
logs/
└── app.log # Auto-created logs
- Email verification
- Soft delete review
- Admin dashboard UI
- PostgreSQL + Alembic migrations