Add Google OAuth configuration and enhance API functionality

- Updated .env.example with WEB_GOOGLE_CLIENT_ID and WEB_GOOGLE_CLIENT_SECRET for Google OAuth.
- Modified README.md to reflect changes in docker-compose for unified web and API deployment.
- Enhanced auth.py to support NextAuth JWT session cookies.
- Improved main.py with lifespan management and additional API endpoints.
- Added mod_overview endpoint in mod.py for MOD panel statistics.
- Updated docker-compose.yml for local API and web service configurations.
This commit is contained in:
2026-03-30 13:55:12 +07:00
parent 5da7cc4530
commit ac5f5db447
6 changed files with 590 additions and 26 deletions
+18 -4
View File
@@ -64,18 +64,32 @@ curl http://localhost:8000/api/health
## Docker Compose
### Production-style API only (external DBs)
Current `docker-compose.yml` supports a unified deployment for both web + API.
### Web + API (use external DBs)
```bash
docker compose up -d --build api
docker compose up -d --build api web
```
### Full local stack (API + Postgres + Mongo)
Required env for web OAuth in `.env`:
```env
WEB_GOOGLE_CLIENT_ID=web-client-id.apps.googleusercontent.com
WEB_GOOGLE_CLIENT_SECRET=replace-with-web-google-client-secret
```
### Full local stack (API local + Postgres + Mongo)
```bash
docker compose --profile localdb up -d --build
docker compose --profile localdb up -d --build api-local postgres mongo
```
Notes:
- `api` listens on port `8000` and is intended for external DB deployments.
- `api-local` listens on port `8001` and automatically points to `postgres` + `mongo` containers.
- `web` listens on port `3000` and calls API internally through `http://api:8000`.
## Implemented Endpoints
- GET /api/health