Module Overview
Project Setup & Data Layer
This module lays the foundation everything else in SKYWATCH is built on: the monorepo that holds the frontend, the backend, and the types they share, plus the Postgres schema that every later module reads from and writes to.
Why This Matters
SKYWATCH isn’t one app, it’s three: a background poller that never stops running, a WebSocket server, and a Next.js frontend. Those are different runtime concerns that don’t belong in a single process, but the frontend and backend still need to agree on shapes like “what does an aircraft’s live state look like.” Get the workspace structure and the shared-types setup wrong at the start, and every later module pays for it — either with duplicated type definitions quietly drifting out of sync, or with a database schema that has to be patched under pressure once it’s already holding real data. This module sets both of those up correctly the first time.
What You’ll Learn
- Setting up an npm workspaces monorepo with three packages:
apps/web,apps/server, andpackages/shared - Why
packages/sharedis buildless — no compile step, no “rebuild shared first” step to forget - Modeling the core Postgres tables with Drizzle:
position_snapshots,squawk_alerts,overflight_log,home_location, andwatch_regions - Pushing data invariants (like “at most one default watch region”) into the database itself with check constraints and partial unique indexes
- The generate → review → migrate workflow you’ll reuse every time the schema changes for the rest of the course
Outcome
By the end of this module, you’ll have a working monorepo with a shared, buildless TypeScript package resolving cleanly in both apps, and a migrated Postgres database with all five core tables in place.
Let’s get started.