This project provides a complete authentication solution that can be integrated into any application. It includes JWT authentication, refresh tokens, OAuth2 login (Google, GitHub), an Admin Panel UI, and Dockerized deployment for easy setup.
- FastAPI Backend
- JWT Authentication (Access + Refresh Tokens)
- OAuth2 (Google, GitHub)
- Secure password hashing (bcrypt)
- Frontend (React)
- Login and Register pages
- Admin Panel for user management
- Database: PostgreSQL
- Deployment: Docker Compose for full stack
- .env configuration: Ready for API keys and secrets
- Docker & Docker Compose
- Python 3.10+ (for the generator script)
- Node.js 18+ (if you run the frontend without Docker)
- OAuth credentials for Google and GitHub
python generate_auth_service.py
This will create the auth-service/
directory with all required files.
Create a .env
file in the root directory:
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
DATABASE_URL=postgresql://postgres:postgres@db:5432/auth_db
JWT_SECRET=your_jwt_secret
cd auth-service
docker-compose up --build
- Backend → http://localhost:8000
- Frontend → http://localhost:3000
POST /auth/login
→ Login with username/password, returns JWT tokensGET /auth/oauth/google
→ Start Google OAuth flowGET /auth/oauth/github
→ Start GitHub OAuth flowGET /admin/users
→ Fetch users (Admin only)
- Login Page → Authenticate via username/password or social login (Google/GitHub)
- Register Page → Placeholder for user registration
- Admin Panel → View users (expandable for user management)
auth-service/
├── backend/ # FastAPI backend
├── frontend/ # React frontend
├── docker-compose.yml
├── .env.example
├── README.md
└── LICENSE
- Full registration flow
- Role-based access control in Admin Panel
- Integration with local authentication providers
- Advanced logging and audit trails
MIT