How craniacshencil/got-to-do works
Main Components
a) Client Layer:
• External clients (curl/scripts) making HTTP requests
• Various bash scripts in the /scripts directory that interact with the API
b) API Layer:
• Entry point through cmd/main.go and routes
• Handlers from pkg/handlers/* showing different endpoints:
• Authentication handlers (login, signup)
• TODO list handlers (create, update, delete, display)
• Task handlers (add, delete)
c) Internal Services Layer:
• JWT authentication service (pkg/myJwt)
• Password handling service (pkg/passwords)
• Signup validation service (internal/signup)
d) Data Access Layer:
• Database interface (internal/database)
• SQL queries and models
• Separation between:
• Users and passwords
• Todo lists
• Tasks
e) Database Layer:
• PostgreSQL database
• Four main tables from sql/schema:
• users
• user_passwords
• todo_lists
• tasks
Specific Elements
a) Authentication Flow:
• Complete flow from login/signup requests
• JWT token generation and validation
• Password hashing and verification process
b) Data Flow:
• Request handling path from routes to handlers
• Database query flow through the data access layer
• Response path back to client
c) Infrastructure Elements:
• Docker container boundary
• Environment configuration (.env.local and .env.docker)
• Database connection configuration
Database Layer
Left to Right in each layer:
• Related functionality (auth, todo lists, tasks)
• Clear dependencies between components
Additional Notes
• Notes about Docker configuration
• Database migration flow
• Environment configuration impact
• Version information for major components
Technical Details to Emphasize
• Go-specific patterns used
• SQL query organization (using sqlc)
• Authentication mechanism (JWT)
• Password handling security
• Database schema relationships
Remember to maintain a balance between showing the technical implementation details and keeping the high-level architecture clear and understandable.