How olartbaraq/ra-nkan_backend works
SpectrumShelf is a Go/Gin ecommerce API. Clients call the registered auth, catalog, shop, product, and order endpoints; handlers validate requests and use generated SQL queries to work with PostgreSQL, returning API responses. Authentication supports password registration/login, token refresh/logout, and Google sign-in; product media can use Cloudinary. The tree and README establish the broader ecommerce domains, but most handler implementations were not sampled, so their detailed query wiring is not shown. Redis is initialized in server setup, but its runtime use is not established by the excerpts.
Main entry points: server.go Gin server · oauth.go Google sign-in · auth.go Auth API · sqlc SQL queries
Components 18
API runtime
- Gin server
api/server.go
Identity
- User API
api/user.go - Auth API
api/auth.go - Google sign-in
api/oauth.go - Auth middleware
api/middleware.go - JWT tokens
utils/token.go
Commerce domains
- Category API
api/category.go - Subcategory API
api/sub_category.go - Shop API
api/shop.go - Product API
api/product.go - Order API
api/order.go
Data and integrations
- SQL queries
db/sqlc - PostgreSQL
- Media service
api/media_service.go - Cloudinary
- Google identity
- Redis client
Other components
- API client
Connections 19
- API client → Gin server: HTTP requests
- Gin server → User API: register routes
- Gin server → Auth API: register routes
- Gin server → Google sign-in: register routes
- Gin server → Category API: register routes
- Gin server → Subcategory API: register routes
- Gin server → Shop API: register routes
- Gin server → Product API: register routes
- Gin server → Order API: register routes
- Gin server → Redis client: initializes client
- Auth API → SQL queries: user queries
- Google sign-in → SQL queries: user queries
- Auth API → JWT tokens: create and verify
- Google sign-in → JWT tokens: create tokens
- Auth middleware → JWT tokens: verify tokens
- Google sign-in → Google identity: fetch token info
- SQL queries → PostgreSQL: SQL reads and writes
- Media service → Cloudinary: upload images
- Product API → Media service: media operations