Vishal.dev
Back
```code```notes · canvas · boards
Full-Stack

Blockboard — Block-Based Note Workspace

A block-based workspace for notes, canvases, and lightweight project boards — Next.js frontend on Vercel, a Go REST API on EC2, PostgreSQL via Neon, S3 presigned uploads, and cookie sessions.

Next.jsReactGoPostgreSQL (Neon)sqlcAWS S3React EmailPostHogSentryTurborepo
2
Languages
3
Production hosts
5
Block types

Domain Knowledge

What problem this project solves

A hybrid-stack product forces clear ownership boundaries: the frontend handles SSR and rendering, the Go API owns auth, spaces, blocks, sessions, OAuth, and upload presigning, and managed services provide persistence. Cookie sessions with proxy.ts route guards keep the browser↔API contract explicit.

Architecture

How the system is structured

apps/web (Next.js, SSR + a proxy.ts session gate) and apps/api-golang (Go HTTP API with a middleware chain, handlers, services, repositories, sqlc) with a shared packages/emails workspace for React Email templates. Object storage uses presigned URLs; the frontend PUTs directly to S3.

Data Model

Schema design and data flow

PostgreSQL models for users, sessions, spaces, and blocks. Backend layering keeps SQL generated by sqlc — type-safe queries against the schema.

Key Challenges

Hardest problems encountered

The cross-stack design required discipline around the browser↔API contract — cookie auth, CORS with credentials, and presigned upload flows. Running Go and Next.js in one repo needed clean monorepo tooling, and sessions stored in Postgres had to stay consistent across Vercel and EC2.

Scaling Strategy

How the system grows

Vercel serves the frontend at the edge; EC2 hosts the stateful Go API; Neon and S3 scale independently. React Email templates render server-side. PostHog and Sentry provide analytics and error monitoring in production.

Security

Defense-in-depth approach

Cookie-based sessions stored in Postgres, OAuth sign-in, proxy.ts route guards, and private S3 buckets accessed only through short-lived presigned URLs.

Failure Handling

Resilience and recovery

Sentry captures errors across both the Next.js and Go sides; session validation gates every API call with clear redirect flows on expiry.

Observability

Monitoring and debugging

PostHog product analytics and Sentry error monitoring wired into both the frontend and the Go API in production.

Trade-offs

Engineering decisions and alternatives

Go API over Node for performance and static binaries. sqlc over an ORM for explicit, type-safe SQL. Vercel + EC2 split over a single host for edge delivery plus a persistent API.

Architecture Decisions

Key choices and what was rejected

Decision
Chosen
Rejected
Backend language
Go HTTP API + sqlc
Node/TS API
Sessions
Cookie-based in Postgres
JWT stateless
Uploads
S3 presigned URLs
Server-proxied uploads

Senior-Level Topics

Concepts this project explores

Polyglot ArchitectureCookie Session ManagementPresigned Upload Flowssqlc / Type-Safe SQLMulti-Host Deployment