A high-performance, production-ready backend built with FastAPI. Features secure JWT authentication, password hashing, and paginated resource management. Designed as a foundational architecture for scalable web applications.
- Framework: FastAPI
- Database: SQLite with SQLAlchemy ORM
- Security: OAuth2 with Password (Bearer), Passlib (Bcrypt), Python-Jose (JWT)
- Validation: Pydantic
- Server: Uvicorn
- Secure Authentication: User signup and login with hashed passwords (Bcrypt).
- JWT Authorization: Stateless token-based protection for sensitive endpoints.
- User Management: Create, Read, Delete users with skill-based filtering and sorting.
- Product Management: Create and list products with authentication.
- Pagination & Filtering: Optimized
skipandlimitquery parameters with skill-based filtering. - Sorting: Sort users by age or creation date (ascending/descending).
- Robust Error Handling: Clear HTTP status codes (400, 401, 404).
git clone https://github.com/MohamedSharfan/user-registration-backend.git
cd user-registration-backendpython -m venv venv
# Windows
venv\Scripts\activate
# Mac/Linux
source venv/bin/activatepip install -r requirements.txtCreate a .env file in the project root:
SECRET_KEY=your_super_secret_key_hereuvicorn main:app --reloadVisit http://127.0.0.1:8000/docs to explore the interactive API documentation.
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /login |
Get access token (JWT) | ❌ |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /users/ |
Register a new user | ❌ |
| GET | /users/ |
Get all users (sortable by age/created_at) | ❌ |
| GET | /users/me |
Get current user details | ✅ |
| GET | /users/{stu_id} |
Get user by ID | ❌ |
| GET | /users/users?skill=<skill>&skip=0&limit=10 |
Filter users by skill (paginated) | ✅ |
| DELETE | /users/{stu_id} |
Delete a user | ✅ |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /products/ |
Create a new product | ✅ |
| GET | /products/items?skip=0&limit=10 |
Get list of products (Paginated) | ❌ |
<<<<<<< HEAD
=======
3e79c93084fc954d0319f8767deacaef4f26a487 This project is licensed under the MIT License.