Skip to main content

System Overview

AskAtlas is a full-stack application with a Go backend API, Next.js frontend, and PostgreSQL database, deployed to Digital Ocean via Docker containers.

Architecture Diagram

Component Responsibilities

Frontend (web/)

  • App Router — Next.js pages and layouts using route groups ((dashboard), (marketing))
  • Clerk SDK — Client-side authentication, session management, and route protection via middleware
  • Feature modules — Business logic and UI components organized under lib/features/

Backend (api/)

  • chi Router — HTTP routing with middleware chain (request ID, logging, auth, timeout)
  • ClerkAuth Middleware — Validates Clerk JWTs, resolves external Clerk IDs to internal user UUIDs
  • Handlers — HTTP request/response handling, parameter parsing, error responses
  • Services — Business logic, validation, data transformation
  • Repositories — Database access via sqlc-generated type-safe queries

Database

  • PostgreSQL — Primary data store with users, files, grants, views, and favorites tables
  • Migrations — Version-controlled schema changes via golang-migrate

External Services

  • Clerk — Authentication provider. Sends webhook events for user lifecycle (create, update, delete)
  • Infisical — Secret management. Injects environment variables at container startup
  • GHCR — GitHub Container Registry for Docker images

Monorepo Structure

AskAtlas/
├── api/ # Go backend API (chi + sqlc)
├── web/ # Next.js frontend (App Router + Clerk)
├── migrations/ # PostgreSQL schema migrations
├── docs/ # Docusaurus documentation site
├── scripts/ # Deployment and rollback scripts
└── .github/ # CI/CD workflows (checks, deploy, rollback, docs)

Communication Between Services

FromToMethod
BrowserNext.jsHTTPS
Next.jsGo APIHTTP with Clerk JWT in Authorization header
ClerkGo APIWebhook POST with SVIX signature
Go APIPostgreSQLpgx connection pool
Docker containersInfisicalUniversal-auth at startup for secret injection