Video summary
Golang Microservices Full Course #23 - Splitting Auth Service
Main summary
Key takeaways
Summary
The tutorial demonstrates how to extract authentication from a monolithic Go application into a standalone microservice. The Auth Service runs on port 8081, while the API Gateway runs on port 8080.
Service setup
The instructor creates an Auth Service module in the Go workspace and structures it using clean architecture and the repository pattern. The service handles login, refresh tokens, logout, and token security.
Shared code
Common configuration, database connections, logging, middleware, utilities, and error handling are moved into a shared module to avoid duplication across services.
Gateway and containers
The API Gateway is configured to forward requests through a reverse proxy. Dockerfiles and Docker Compose are updated to build and run the new service alongside the gateway and other components.
Data migration and testing
The existing monolith database is exported and imported into the microservices MySQL container to preserve data during the transition. The instructor tests login, refresh, and logout with Postman.
Authentication middleware is also updated so protected routes require a bearer token. After logout, the token is deactivated, and refresh attempts are rejected.
Database separation
The tutorial begins moving toward a database-per-service pattern by creating an Auth Service database and starting a migration for the refresh-token table. Because user data belongs to a separate service and database, the design avoids a cross-database foreign key and adds an index on user_id instead. Ownership of the OTP table is left for later review.
Guide and tutorial topics
- Create and register a Go microservice in a workspace.
- Extract authentication handlers, services, and repositories.
- Reuse shared infrastructure and connect the service through an API Gateway.
- Build and run the service with Docker Compose.
- Test authentication flows and protected routes with Postman.
- Begin separating service databases and creating migrations.
Main speaker/source: Ikhda Muhammad Wildani, presenting the course tutorial.
Rate this summary
Your feedback will help improve summaries.
Improve this summary
Reprocess with a stronger model when the summary feels incomplete or inaccurate.
Translate summary in another language
Ask questions to this video
Chat for follow-up questions, clarifications, and source-backed answers.