Skip to content

gamma-app/ai-coding-interview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gamma Interview

Collaborative document editor with a dashboard, card-based TipTap editor, and real-time sync via Hocuspocus/Yjs.

Architecture

Client (Next.js :4000)  ──GraphQL──>  Server (NestJS :4001)
                                          |
Hocuspocus (:4002)      ──REST────>       |  (load/save ydoc state)
                                          v
                                      PostgreSQL (:5434)

Only the server touches the database. Hocuspocus calls the server's REST API for ydoc persistence. The client uses GraphQL (Apollo) for structured data and connects to Hocuspocus over WebSocket for real-time editing.

Packages

Package Path Description
@interview/client packages/client Next.js (pages router), Chakra UI v2, TipTap 3, Apollo Client
@interview/server packages/server NestJS, Prisma + PostgreSQL, GraphQL (schema-first), REST for ydoc endpoints
@interview/hocuspocus packages/hocuspocus @hocuspocus/server, custom persistence extension that syncs ydoc state through the server
@interview/ui packages/ui Design system: Chakra theme, colors, icons (Font Awesome), components
@interview/shared packages/shared Shared types and constants

Prerequisites

  • Node.js 22+
  • Yarn 1.x
  • Docker (for PostgreSQL and Redis)

Setup

# Install dependencies
yarn install

# Set up environment variables
cp .envrc.example .envrc
direnv allow  # or: source .envrc

# Start infrastructure (PostgreSQL on :5434, Redis on :6391)
./scripts/setup-local-services.sh up

# Run database migrations
yarn db:migrate

# Seed the database (4 users, 7 sample docs)
yarn db:seed

# Build package dependencies (UI package)
yarn workspace @interview/client build:deps

# Start all services
yarn dev

Then open http://localhost:4000. You'll be prompted to pick a user.

Scripts

Root

Command Description
yarn dev Start client, server, and hocuspocus concurrently
yarn db:migrate Run Prisma migrations
yarn db:seed Seed the database
yarn db:reset Drop database, re-migrate, and re-seed
yarn db:studio Open Prisma Studio

Infrastructure

Command Description
./scripts/setup-local-services.sh up Start PostgreSQL and Redis
./scripts/setup-local-services.sh down Stop services
./scripts/setup-local-services.sh reset Stop services and destroy all data
./scripts/setup-local-services.sh status Show service status

Database

Prisma schema and migrations live in packages/server/src/db/. The server package manages all database access through PrismaService, which is provided via PrismaModule — each NestJS module that needs database access imports PrismaModule explicitly.

Ports

Service Port
Client 4000
Server 4001
Hocuspocus 4002
PostgreSQL 5434
Redis 6391

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages