A lightweight user management microservice built with FastAPI, async SQLAlchemy, and PostgreSQL. The service is containerized with Docker and designed for cloud deployment, with GCP architecture, images included in the microservice docs folder.
services/user/— User microservice implementation.services/user/src/— FastAPI app, routers, data models, DB configuration, and operations.services/user/docs/— Architecture and deployment images used by the README.
- Microservice architecture with isolated user service implementation
- FastAPI REST API for user CRUD operations
- Async SQLAlchemy +
asyncpgPostgreSQL backend - Dockerized service for local development and cloud deployment
- Git and GitHub-based version control with GitHub Actions CI/CD
- Workload Identity Federation (WIF) / OIDC authentication for GCP deployments
- Google Cloud Run deployment with Cloud SQL integration
- Google Artifact Registry for Docker image storage
- Swagger and ReDoc documentation exposed at custom endpoints
- GitHub Actions workflow:
.github/workflows/deploy-user.yml - Uses
google-github-actions/auth@v2with a workload identity provider for OIDC-based GCP auth - Builds and pushes Docker images to Artifact Registry in
asia-south1 - Deploys the service to Cloud Run as
user-service - Connects Cloud Run to Cloud SQL instance
user-instance - Includes GCP setup scripts in
services/user/scripts/:gcp_setup_using_wif.shgcp_setup_using_keys.sh
Create a .env file in services/user/ with values for:
DEBUGURL(e.g.postgresql+asyncpg://user:password@host:5432/dbname)ECHOPOOL_SIZEMAX_OVERFLOWPOOL_TIMEOUTPOOL_RECYCLEFUTURE
cd services/user
uvicorn src.main:user_api --host 0.0.0.0 --port 8080docker build -t project024-user ./services/user
docker run --env-file services/user/.env -p 8080:8080 project024-user- Swagger UI:
http://localhost:8080/documentation/Swagger - ReDoc:
http://localhost:8080/documentation/ReDoc - OpenAPI JSON:
http://localhost:8080/documentation/openapi.json
All endpoints are under the /user prefix.
POST /user/— Create a new userGET /user/— Retrieve user detailsPATCH /user/— Update user detailsDELETE /user/— Delete a user
swagger_ui
gcp_cloud_run_container
gcp_cloud_sql_postgresql
gcp_cloud_artifact_repository
gcp_cloud_artifact_image




