Next.jsReactSaaSStarter

go-nextjs-ai-saas-starter — Next.js SaaS Template

By azerturk

A development preview template for multi-tenant AI document processing built on Go and Next.js, covering document ingestion, permission-aware retrieval, citation-based Q&A, extraction review, and subscription billing boundaries.

Explore the design

Compare the page layouts and mobile experience. Open any screenshot for a closer look.

1 previews
Author preview
Author-provided preview

Preview provided in the project README.

One original preview is available. Open the full image to inspect the design.

Screenshots show visual appearance; interactive behavior may differ.

Recorded 2026-10-01View source

What stands out

A quick read of the recorded project description.

01

Stytch B2B magic link authentication, with HttpOnly web cookies and a Bearer JWT contract coexisting

02

Go side enforces organization context, tenant isolation, admin/manager/member roles, and subscription validation

03

PostgreSQL with per-module schema ownership, enforced tenant RLS, SQLC, and three database roles

04

PDF upload, ClamAV scanning, S3-compatible storage, OCR, embeddings, hybrid retrieval, and permission-aware RAG citations

05

Typed extraction templates, persisted runs, human approval, and signed HTTPS webhook delivery

06

Polar billing adapter with local catalog, entitlements, usage, quotas, checkout, and portal boundaries

Template Details

This template is a development preview foundation for multi-tenant AI document operations, with a Go modular monolith backend and a Next.js UI/SSR layer that calls a versioned Go API directly. The repository currently uses development as its only default branch and is positioned for local development and architecture research; the author explicitly states it is not production-ready, and real vendor acceptance, production deployment, CI/CD, and release automation remain roadmap work.

Implemented capabilities cover authentication and tenant isolation, document processing and retrieval, extraction review, subscription billing boundaries, and background tasks with observability. Authentication uses Stytch B2B magic links, with HttpOnly web cookies and a Bearer JWT contract for future mobile/API clients; the Go side enforces organization context, tenant isolation, admin/manager/member roles, permissions, fresh session checks, and subscription validation. The data layer uses PostgreSQL with per-module schema ownership, enforced tenant RLS, SQLC, and three explicit database roles for requests, workers, and migrations. The document pipeline includes PDF upload, ClamAV scanning, S3-compatible local object storage, document versioning, OCR, embeddings, hybrid retrieval, permission-aware RAG, and byte-level citations. The extraction component provides typed templates and persisted runs, immutable results, human approval/rejection, publishing/export of approved outputs, and signed HTTPS webhook delivery. Billing includes a Polar adapter plus local catalog, entitlements, usage, reservations, quotas, checkout, portal, and webhook boundaries. There are also product SMTP notifications, immutable audit evidence, transactional outbox, Redis Streams, retries, DLQ, and whitelist replay tooling, as well as OpenTelemetry tracing, private Prometheus metrics, structured redacted logs, readiness checks, architecture fitness tests, and synthetic RAG evaluations.

Limitations: external business vendors are not replaced by runtime fake implementations; vendors are either explicitly disabled or selected with complete configuration, and incomplete configuration causes startup failure. Credential-free local tests cannot prove real R2, Polar, Mistral, OpenAI, SMTP, Stytch production domains, public webhook receivers, authenticated browser, or native mobile behavior. Database migrations are a resettable canonical development baseline, and contributors may need to rebuild local data after schema changes. Local development depends on Docker Compose, Go, Node.js, and pnpm, and requires a Stytch B2B test project.

Next.jsSaaSStarter

Is it right for your project?

Use Cases

  • Set up a local development environment for multi-tenant AI document Q&A and retrieval workflows
  • Study how a Go modular monolith and a Next.js frontend/backend separation are organized
  • Verify the end-to-end chain of document upload, scanning, OCR, embeddings, and citation-based answers
  • Experiment with typed extraction, human review, and export of approved results
  • Evaluate how subscription entitlements, quotas, and usage boundaries are implemented in a SaaS context

Suitable For

  • Go and Next.js developers who want to study multi-tenant AI document processing architecture
  • Teams or individuals who need a local development preview rather than a production deployment
  • Engineers interested in permission-aware RAG, audit evidence, and background task patterns
  • Contributors planning secondary development and extension based on MIT-licensed code

Getting started & customization

Use these recorded setup notes alongside the repository instructions for your chosen version.

  1. 1

    Requires Docker Desktop and Docker Compose, Go, Node.js, and pnpm, plus a Stytch B2B test project.

  2. 2

    First install frontend dependencies and run setup.sh to generate local configuration, then fill Stytch test credentials into the ignored backend/app.env.

  3. 3

    Use make dev to start the API, worker, and frontend; local web, Go API, Swagger UI, and Mailpit listen on their respective ports.

  4. 4

    Database migrations are a resettable development baseline, and local data may need to be rebuilt after schema changes.

  5. 5

    Credential-free local tests cannot cover real R2, Polar, Mistral, OpenAI, SMTP, Stytch production domains, or public webhook behavior.

Read repository instructions

License & source material

Usage conditions & limitations

Free to use · keep license notice

This entry covers the free version in the public repository under the MIT license; the free scope is that version's code and does not mean external services or third-party assets are free.

Must comply with when using

  • You may use, modify, commercialize, and distribute this version's code for free.
  • When distributing copies or substantial portions of the code, retain the original author's copyright notice and the full MIT license notice.
  • The code is provided as is; warranties and liability limitations are governed by the original license and applicable law.

Additional costs & items to verify

  • Running locally requires creating your own Stytch B2B test project and providing credentials; authentication and magic link emails depend on the external Stytch service.
  • Stytch test credentials must be filled into backend/app.env to start; without credentials the authentication flow cannot be completed.
  • Credential-free tests cannot verify real R2, Polar, Mistral, OpenAI, SMTP, Stytch production domains, public webhooks, authenticated browsers, or native mobile behavior.
  • External business vendors cannot be replaced by runtime fake implementations; a selected vendor must have complete configuration, otherwise startup fails.
  • Database migrations are a resettable development baseline, and contributors may need to rebuild local data after schema changes.
  • The project is explicitly not production-ready and is only suitable for local development and architecture research.
  • Production deployment, CI/CD, release automation, and operational certification remain roadmap work and are not yet implemented.
  • Real vendor acceptance has not been recorded, so it cannot be considered production-grade validation.
  • Demo images, fonts, icons, and other third-party assets must be checked against their own licenses; the code's MIT license alone is not sufficient.
  • External services such as domains, hosting, databases, payments, or AI may incur separate charges.
View Original Text Basis

Permission is hereby granted, free of charge

Original License Text

a Stytch B2B test project for authentication

Original README

Add your Stytch test credentials to ignored `backend/app.env`

Original README

Credential-free local tests do not prove real R2, Polar, Mistral, OpenAI, SMTP, Stytch production-domain, public webhook-recipient, authenticated-browser, or native-mobile behavior.

Original README

External business providers are never replaced by runtime fakes. A provider is either explicitly disabled or selected with complete configuration; incomplete selected providers fail startup.

Original README

database migrations are a resettable canonical development baseline and may require contributors to recreate local data after a schema change

Original README

it is not production-ready

Original README

Production deployment, CI/CD, release automation, and operational certification remain roadmap work.

Original README

Real-provider acceptance is not yet recorded for this local-development system.

Original README
https://github.com/azerturk/go-nextjs-ai-saas-starter/blob/development/LICENSEhttps://github.com/azerturk/go-nextjs-ai-saas-starter/blob/development/README.md

Compiled by DeepSeek based on repository license and README ·2026-10-01. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.

Project checks & description sources

Template Information

Source platforms
GitHub
Documentation and maintenance reference score
Partly documented · 73 / 100
Technologies
Next.js · React
Website type
SaaS · Starter
How this score is calculated

Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.

What to verify for this project

Repository update recorded
2026-08-18
Screenshot last checked
2026-10-01

No demo link is recorded. Use the repository instructions to evaluate the project locally; the screenshot alone cannot establish interactive behavior.

The catalog identifies Next.js as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.

Use a selection guide →

How this description was prepared

AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.

Automatically checked against source and license rules; no manual editorial review.

Inspect the recorded source material

SHA-256: 7116132c5b395561a179a6ac305ae305570f1925bd59ef19920daebfff2ea23c

2026-10-01T01:10:23.529Z

Source file / repository
# Go + Next.js AI SaaS Starter

A development-preview foundation for building multi-tenant AI document operations with Go and Next.js. It combines secure document ingestion, permission-aware retrieval, cited AI answers, typed extraction and review workflows, commercial entitlement boundaries, durable background processing, and audit evidence in one pragmatic modular monolith.

> **Status:** Experimental hobby project currently in active development. This repository is designed for local development and architecture study; it is not production-ready. Real-provider acceptance is not yet recorded for this local-development system. Production deployment, CI/CD, release automation, and operational certification remain roadmap work.

The initial public repository uses `development` as its only/default branch. A stable `main` branch will be created only when the production track is explicitly promoted. Until then, database migrations are a resettable canonical development baseline and may require contributors to recreate local data after a schema change.

![Dashboard preview](docs/dashboard.png)

## What is implemented

- Stytch B2B magic-link authentication with HttpOnly web cookies and a Bearer JWT contract for future mobile/API clients.
- Go-enforced organization context, tenant isolation, canonical `admin`/`manager`/`member` roles, permissions, fresh-session checks, and subscription enforcement.
- PostgreSQL schema-per-module ownership, forced tenant RLS, SQLC, and explicit request/worker/migration database roles.
- PDF upload, ClamAV scanning, S3-compatible local object storage, document versions, OCR, embeddings, hybrid retrieval, permission-aware RAG, and byte-exact citations.
- Typed extraction templates and durable runs, immutable results, human approval/rejection, approved-output publication/export, and signed HTTPS webhook delivery.
- Polar adapters plus local catalog, entitlement, usage, reservation, quota, checkout, portal, and webhook boundaries.
- Product SMTP notifications, immutable audit evidence, transactional outbox, Redis Streams, retry, DLQ, and allowlisted replay tooling.
- OpenTelemetry traces, private Prometheus metrics, structured redacted logs, readiness checks, architecture fitness tests, and synthetic RAG evaluation.

External business providers are never replaced by runtime fakes. A provider is either explicitly disabled or selected with complete configuration; incomplete selected providers fail startup.

## Architecture

The backend is one Go modular-monolith codebase with coordinated API, worker, and bounded operator runtime roles. The architecture is intentionally pragmatic:

- module roots expose public contracts; private application, domain, transport, repository, worker, and provider code stays behind each owner boundary;
- ports and adapters are introduced where ownership, substitution, or external infrastructure requires them, not for every function;
- lifecycle, authorization, provenance, quota, replay, and publication invariants use focused domain types, while straightforward orchestration remains layered application code;
- use cases may be organized as vertical slices inside a module without bypassing the module and layer rules;
- synchronous invariants use direct public contracts, while durable jobs and integration facts use transactional outbox plus Redis Streams;
- Next.js is the UI/SSR layer and calls the versioned Go API directly; it is not a business BFF.

See the [current-system documentation](docs/current-system/README.md) and [architecture overview](docs/architecture/overview.md).

## Technology

- Go 1.26.6, Gin, SQLC, PostgreSQL 17, pgvector, Redis 8 Streams
- Next.js 16.3.0, React 19.2.8, TypeScript, Tailwind CSS 4, TanStack Query
- MinIO for local S3-compatible storage, Mailpit for local product email, ClamAV for upload scanning
- Stytch, Cloudflare R2, Mistral OCR, OpenAI, Polar, generic SMTP, and hardened HTTPS webhooks behind explicit adapters

## Local quick start

Prerequisites:

- Docker Desktop with Docker Compose
- Go 1.26.6
- Node.js 24.19.0 and pnpm 11.20.0
- a Stytch B2B test project for authentication

Select the pinned Node.js and package-manager versions:

```bash
nvm install 24.19.0
nvm use 24.19.0
corepack enable
corepack prepare [email protected] --activate
```

Install frontend dependencies, create local configuration, and start local infrastructure:

```bash
cd frontend
pnpm install --frozen-lockfile
cd ..
chmod +x setup.sh
./setup.sh
```

Add your Stytch test credentials to ignored `backend/app.env`, then start the API, worker, and frontend:

```bash
make dev
```

Local endpoints:

- web: [http://localhost:3000](http://localhost:3000)
- Go API: [http://localhost:8080](http://localhost:8080)
- Swagger UI: [http://localhost:8080/swagger/index.html](http://localhost:8080/swagger/index.html)
- Mailpit product-email UI: [http://localhost:8025](http://localhost:8025)

Mailpit captures only product SMTP messages. Stytch sends authentication and magic-link email through Stytch infrastructure.

## Verification

```bash
make test
make test-integration
make test-e2e
```

Specialist backend gates are available under `backend/`, including `make test-worker`, `make test-race`, `make test-fuzz`, `make rag-eval`, `make sqlc`, `make swagger`, `make lint`, and `make build`. Frontend gates include `pnpm test`, `pnpm lint`, `pnpm typecheck`, `pnpm build`, and `pnpm api:contracts:check`.

Credential-free local tests do not prove real R2, Polar, Mistral, OpenAI, SMTP, Stytch production-domain, public webhook-recipient, authenticated-browser, or native-mobile behavior. See [testing](docs/testing.md) for the exact boundary.

## Documentation

- [Setup](SETUP.md)
- [Development guide](DEVELOPMENT.md)
- [Configuration](docs/configuration.md)
- [Current system](docs/current-system/README.md)
- [Architecture](docs/architecture/overview.md)
- [Backend developer guides](backend/docs/README.md)
- [Frontend developer guides](frontend/docs/README.md)
- [Database ownership](docs/database/schema-ownership-baseline.md)
- [Testing](docs/testing.md)
- [Security](SECURITY.md)
- [Roadmap](docs/roadmap.md)

## License

[MIT License](LICENSE)

## Acknowledgements

This project was originally based on
`moasq/production-saas-starter` by Mohammed Salim
and has since been substantially modified and extended.

The original project is licensed under the MIT License.
Report a correction

Explore similar templates

Compare previews and descriptions within the same stack and category.