{"id":42365503,"url":"https://github.com/dmm1/fastapi-starter","last_synced_at":"2026-01-27T18:15:39.785Z","repository":{"id":297112465,"uuid":"995602120","full_name":"dmm1/fastapi-starter","owner":"dmm1","description":"A comprehensive Fastapi Starter Project with a React Frontend and an Mobile App","archived":false,"fork":false,"pushed_at":"2025-08-24T15:11:11.000Z","size":529,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-24T17:03:20.708Z","etag":null,"topics":["expo","fastapi","jwt-authentication","mobile","rabac","react","react-native","shadcn","tanstack"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dmm1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-03T18:29:59.000Z","updated_at":"2025-08-24T15:12:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"cb68a1a0-7779-4ef5-b055-56aa40097ea3","html_url":"https://github.com/dmm1/fastapi-starter","commit_stats":null,"previous_names":["dmm1/fastapi-starter","dmm1/fastapi-starter-old"],"tags_count":1,"template":true,"template_full_name":null,"purl":"pkg:github/dmm1/fastapi-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmm1%2Ffastapi-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmm1%2Ffastapi-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmm1%2Ffastapi-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmm1%2Ffastapi-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmm1","download_url":"https://codeload.github.com/dmm1/fastapi-starter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmm1%2Ffastapi-starter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28817797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:01:38.485Z","status":"ssl_error","status_checked_at":"2026-01-27T18:01:27.499Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["expo","fastapi","jwt-authentication","mobile","rabac","react","react-native","shadcn","tanstack"],"created_at":"2026-01-27T18:15:39.101Z","updated_at":"2026-01-27T18:15:39.777Z","avatar_url":"https://github.com/dmm1.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fastapi-Starter Project - Modern Authentication System\n\nA modern authentication system starter built with **FastAPI** backend and a **React frontend** using shadcn/ui, dark mode, avatar management, and a modern admin dashboard. This project provides a solid foundation for production-ready apps with role-based access control, user management, and beautiful UI/UX.\n\n\u003e 🎯 **Purpose**: The included React frontend is designed for **real-world authentication and admin flows**. Easily extend with more features or integrate with your own backend.\n\n## 🚀 Quick Start (Both Servers)\n\nThe easiest way to run both backend and frontend simultaneously:\n\n```bash\npython run.py\n```\n\nThis will start:\n\n- **Backend API** on \u003chttp://localhost:8000\u003e\n- **Frontend UI** on \u003chttp://localhost:3000\u003e (React + shadcn)\n\nPress `Ctrl+C` to stop both servers.\n\n## 🌟 Features\n\n### Frontend (React + shadcn/ui)\n\n- ✅ **Modern UI/UX**: Built with shadcn/ui, dark mode, and beautiful design\n- ✅ **Avatar Management**: Upload, preview, and delete profile avatars\n- ✅ **Admin Dashboard**: Stats, user management, and role badges\n- ✅ **Role-Based Navigation**: Dynamic UI based on user roles\n- ✅ **Theme Toggle**: Built-in dark mode support\n- ✅ **Profile Page**: Edit profile, change password, manage avatar\n- ✅ **Login/Register**: Modern forms with validation and error handling\n- ✅ **Responsive Design**: Works on mobile and desktop\n- ✅ **TanStack Router**: Modern routing and navigation\n- ✅ **API Client**: Automatic token refresh and error handling\n\n### Backend (FastAPI)\n\n- ✅ **Avatar Upload/Delete**: Endpoints for uploading and deleting user avatars\n- ✅ **Static File Serving**: Avatars served via `/static/avatars/`\n- ✅ **Modern Architecture**: Modular FastAPI with separation of concerns\n- ✅ **JWT Authentication**: Access and refresh tokens with role information\n- ✅ **Secure Session Management**: Redis-backed session tracking with device information\n- ✅ **Role-Based Access Control (RBAC)**: Flexible role management system\n- ✅ **SQLite Database**: Persistent storage with SQLAlchemy ORM\n- ✅ **User Management**: Registration, login, profile updates\n- ✅ **Admin Panel**: Admin-only user management endpoints\n- ✅ **API Versioning**: Clean `/api/v1/` endpoints\n- ✅ **OAuth2 Compatible**: Standard OAuth2 password flow\n- ✅ **Auto Documentation**: Swagger UI at `/docs`\n- ✅ **Enhanced Security**: Password policies and security headers\n- 🆕 **Custom Rate Limiting**: High-performance rate limiting with configurable limits\n- 🆕 **Session Tracking**: Track active sessions with device info and IP addresses\n- 🆕 **Monitoring**: Comprehensive metrics and health checks\n- 🆕 **Structured Logging**: JSON-formatted security event logging\n- 🆕 **Production Ready**: Enhanced security and observability\n\n## 📁 Project Structure\n\n```bash\nFastapi-Starter/\n├── run.py                    # 🎯 Start both servers\n├── backend/                  # 🔧 FastAPI Backend\n│   ├── run.py               # Backend server entry point\n│   ├── app/                 # Modular FastAPI application\n│   ├── data/                # SQLite database \u0026 avatar uploads\n│   └── requirements.txt     # Python dependencies\n└── frontend/                # 🧑‍💻 React Frontend (shadcn/ui)\n    ├── src/                 # React source code\n    ├── public/              # Static assets\n    ├── package.json         # Frontend dependencies\n    └── README.md            # Frontend guide\n```\n\n## 🖼️ Avatar Management\n\n- **Upload Avatar**: Go to Profile, click avatar, upload image (PNG/JPG/GIF up to 5MB)\n- **Delete Avatar**: Click 'Delete Current' in avatar dialog\n- **Avatar Storage**: Avatars are stored in `backend/data/uploads/avatars/` and served at `/static/avatars/`\n- **Fallback**: If no avatar, Dicebear initials are shown\n\n## 🛡️ Admin Dashboard\n\n- **Stats Cards**: Total users, admins, active/inactive users\n- **User Table**: Avatar, status, roles, actions (edit/delete)\n- **Role Badges**: Visual role indicators\n- **Search**: Filter users by name/email\n\n## 🔐 Session Management\n\n- **Secure Sessions**: Redis-backed session storage with database fallback\n- **Device Tracking**: Track login device, browser, and IP address information\n- **Session List**: View all active sessions in user profile\n- **Remote Logout**: Delete sessions from other devices\n- **Automatic Cleanup**: Expired sessions are automatically removed\n- **Session Cookies**: Secure, HttpOnly cookies for enhanced security\n\n## ⚡ Rate Limiting \u0026 Security\n\n- **Custom Rate Limiting**: High-performance in-memory rate limiting\n- **Configurable Limits**: Environment-based rate limit configuration\n- **Endpoint-Specific**: Different limits for auth, API, and admin endpoints\n- **Security Headers**: CSRF protection, HSTS, and content security policies\n- **Monitoring**: Real-time metrics and health checks\n- **Admin Protection**: Special rate limits for admin operations\n\n## 📝 API Endpoints (Key additions)\n\n| Method | Endpoint | Description |\n|--------|----------|-------------|\n| POST   | `/api/v1/users/me/avatar` | Upload user avatar |\n| DELETE | `/api/v1/users/me/avatar` | Delete user avatar |\n| GET    | `/static/avatars/{filename}` | Serve avatar image |\n| GET    | `/api/v1/sessions/` | Get user's active sessions |\n| DELETE | `/api/v1/sessions/{session_id}` | Delete specific session |\n| GET    | `/metrics` | Application metrics (admin only) |\n\n## 🧑‍💻 Frontend Usage\n\n- **Login/Register**: Modern forms, error handling, dark mode\n- **Profile**: Edit info, change password, manage avatar, view active sessions\n- **Session Management**: View and delete active sessions from other devices\n- **Admin**: Manage users, roles, avatars\n- **Theme Toggle**: Top right in header\n\n## ⚙️ Configuration\n\nThe application supports extensive configuration via environment variables:\n\n### Security \u0026 Authentication\n\n```bash\nSECRET_KEY=your-secret-key\nSECURE_COOKIES=false  # Set to true in production\nHTTPS_ONLY=false      # Set to true in production\n```\n\n### Rate Limiting\n\n```bash\nDEFAULT_RATE_LIMIT=1000 per hour\nAUTH_LOGIN_RATE_LIMIT=5 per minute\nAUTH_REGISTER_RATE_LIMIT=3 per minute\nAPI_GENERAL_RATE_LIMIT=100 per minute\nADMIN_OPERATIONS_RATE_LIMIT=50 per minute\n```\n\n### Session \u0026 Redis\n\n```bash\nREDIS_URL=redis://localhost:6379\nACCESS_TOKEN_EXPIRE_MINUTES=30\nREFRESH_TOKEN_EXPIRE_DAYS=7\n```\n\nSee `backend/.env.example` for all available configuration options.\n\n**Happy Coding!** 🎉\n\nBuilt with ❤️ using FastAPI, React, shadcn/ui, and modern web technologies.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmm1%2Ffastapi-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmm1%2Ffastapi-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmm1%2Ffastapi-starter/lists"}