Rights Institute Docs

Development

Install dependencies, run the dev server, and work with the database.

Quick start

# Install dependencies
bun install

# Copy environment config
cp .env.example .env
# Fill in GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, BETTER_AUTH_SECRET, etc.
# See /docs/environment-variables for what each one does.

# Database migrations
bun run db:generate
bun run db:push

# Development
bun run dev          # Vite dev server (Next.js App Router on Cloudflare) → http://localhost:9000

Production build & deploy

bun run build
bun run deploy

The app is built with vinext, which runs the Next.js App Router on top of Vite and deploys to Cloudflare Workers via @cloudflare/vite-plugin. There is no separate Next.js build step — vite.config.ts is the single source of truth for the build pipeline.

Database

The app uses Drizzle ORM against a Turso (libSQL) database in development and Cloudflare D1 in production.

bun run db:generate   # generate a new migration from schema changes
bun run db:push       # push the schema straight to the database
bun run db:studio     # open Drizzle Studio

Schema lives in lib/db/schema.ts, migrations in lib/db/drizzle/.

Repository layout

The repo is a Turborepo on a pnpm workspace. The site is the apps/rights-web app. packages/ holds the feature packages it consumes (site-shell, credit, contract-builder, investor-rank, innovation-timeline, prosper-license, startup-tools), each with its own README, plus prosper-coin (the Solidity contracts). Inside apps/rights-web:

app/                 App Router routes and API handlers
components/          UI and feature modules
  ui/  animations/  text-effects/  cause/  terms-privacy/
lib/                 Server-side and app-level code
  auth/  db/  env/   source.ts (the Fumadocs source loader)
content/docs/        Markdown/MDX for this docs site

Import them through the @/ aliases: @/lib/<name> or @/components/<name> for a module's barrel (import { auth } from '@/lib/auth'), or a file path within it (import { Button } from '@/components/ui/button'). Workspace packages are imported as @rights/<name>/<file> (import Footer from '@rights/site-shell/Footer'). The aliases are declared in tsconfig.json and mirrored in vite.config.ts and vitest.config.ts.

Run tasks from the repo root — pnpm dev, pnpm build, pnpm test — and Turborepo runs them in each app; or cd apps/rights-web and run them there.

Docs site

This documentation is built with Fumadocs and lives at /docs, sourced from Markdown/MDX files in content/docs/. To add a page, drop an .mdx file into content/docs/ (or content/docs/pages/ for a page walkthrough) and list it in the nearest meta.json.