How idee8/shipfree works
Project Type & Purpose
• ShipFree is a full-stack, SaaS-style web application built with Next.js (using the App Router), Supabase for authentication and Postgres (with Drizzle ORM) or MongoDB as the database, Stripe & LemonSqueezy for payments, and Mailgun for email notifications. It’s delivered via Docker in both development and production modes.
File-Structure Analysis
• Top-level directories:
• docker/ (separate dev/prod compose files & Dockerfiles)
• src/ (Next.js app code, custom API routes, UI components, lib, db, utils)
• public/ (static assets)
• config files (next.config.ts, drizzle.config.ts, tailwind.config.ts)
• src/app – the Next.js application (site pages, auth flows, dashboard)
• src/app/api – custom serverless routes for Stripe, LemonSqueezy webhooks, Mailgun integration
• src/lib – wrappers for external services (supabase client/middleware, mailgun)
• src/db – schema.ts & index.ts with Drizzle ORM setup
• docker/dev & docker/prod – multi-service setups (Next.js container, optional Postgres or MongoDB, Portainer)
a. Main Components
• Client Browser / SPA (Next.js React)
• Next.js Server (Node.js, SSR & API routes)
• Database Layer (Supabase-hosted Postgres or self-hosted Postgres/Mongo in Docker)
• Authentication Service (Supabase Auth)
• Payment Gateways (Stripe, LemonSqueezy)
• Email Service (Mailgun)
• Docker Orchestration (Docker Compose, Portainer)
b. Relationships & Data Flows
• Client ↔ Next.js: page requests, API calls (checkout, webhooks, auth)
• Next.js ↔ Supabase Auth: login/register/session validation (via middleware.ts)
• Next.js ↔ Database: CRUD operations via Drizzle ORM (src/db)
• Next.js API Routes ↔ Stripe & LemonSqueezy: redirect to checkout, receive webhooks → update DB → send emails
• Next.js ↔ Mailgun: send transactional emails (via lib/mailgun.ts)
• Docker Compose orchestrates containers: Next.js, DB, Portainer
c. Architectural Patterns & Principles
• Separation of concerns:
• Presentation (components/ui, app/(site))
• Business logic & data access (lib, db, api routes)
• Serverless / Edge functions via Next.js API routes
• Modular configuration via Drizzle config & environment variables
• Containerized micro-services (Next.js, DB)
d. Key Technologies & Libraries
• Next.js (React, App Router)
• TailwindCSS for styling
• Supabase (Auth + Postgres)
• Drizzle ORM (schema.ts + drizzle.config.ts)
• Stripe & LemonSqueezy SDKs (checkout & webhook handlers)
• Mailgun (email notifications)
• Docker & Docker-Compose (multi-stage builds, dev vs. prod)