Documentation Index
Fetch the complete documentation index at: https://mintlify.com/egeuysall/ryva-archive/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Ryva backend is built with Go 1.25 and follows a clean, modular architecture with clear separation of concerns. The codebase is organized into distinct layers and domains, making it easy to navigate and extend.Directory Structure
Internal Directory
Theinternal/ directory contains all private application code that cannot be imported by other projects.
Configuration Layer (internal/config/)
Configuration Layer (internal/config/)
Contains environment-based configuration for different services:
config.go- Main configuration structauth.go- Authentication settings (JWT, Supabase)database.go- Database connection settingsemail.go- Email service configuration (Resend)server.go- HTTP server settingsstripe.go- Payment processing configurationsentry.go- Error tracking configuration
Database Layer (internal/db/)
Database Layer (internal/db/)
Contains SQLC-generated Go code organized by domain:Each domain package includes:
db.go- Database connection wrappermodels.go- Generated model structsquerier.go- Query interface*.sql.go- Generated query implementations
Modules Layer (internal/modules/)
Modules Layer (internal/modules/)
Contains business logic organized by domain:Each module follows the Handler → Service → Repository pattern (see Module Architecture).
Router Layer (internal/router/)
Router Layer (internal/router/)
HTTP routing using Chi router:
router.go- Main router configurationhandlers.go- Handler registrationtypes.go- Router-specific types
/v1/auth/me) and grouped by domain.Shared Layer (internal/shared/)
Shared Layer (internal/shared/)
Database Files
Thedb/ directory contains raw SQL that gets compiled into Go code:
Schema Definitions (db/schema/)
SQL schema files define database structure:
auth.sql- Users tableorganizations.sql- Organizations, members, invitationsbilling.sql- Subscriptions, payment methods, Stripe eventswaitlist.sql- Waitlist entries
auth.sql:Key Dependencies
Fromgo.mod:
Core Dependencies
github.com/go-chi/chi/v5- HTTP routergithub.com/jackc/pgx/v5- PostgreSQL drivergithub.com/golang-jwt/jwt/v5- JWT authenticationgithub.com/stripe/stripe-go/v84- Payment processinggithub.com/resend/resend-go/v2- Email deliverygithub.com/getsentry/sentry-go- Error tracking
Design Principles
Domain-Driven Design
Code is organized by business domain (auth, billing, organizations) rather than technical layers.
Next Steps
Module Architecture
Learn about the Handler → Service → Repository pattern
Database Setup
Configure database and write SQL queries