How ocluf/justship works
Main Components
• UI components (Header, Form elements, Inputs, Buttons, etc.)
• Routes segregated into different concerns such as “(app)” for the main application UI, “(login)” for the authentication flows, and pages like privacy-policy, error handling, and sitemap.xml.
• Backend/Server: This includes server-side logic, APIs, and service integrations.
• Auth logic in src/lib/server/auth.ts
• Database interaction and models (user, signin, email token) in src/lib/server/database
• Email processing (templates and layouts) in src/lib/server/email
• API endpoints for social login (Google OAuth callbacks), email verification, and Stripe payment flows—found within the src/routes structure.
• Database: SQL migration scripts and Drizzle ORM integration are found in the drizzle directory. Migration scripts (0000, 0001, etc.) and snapshots ensure the database schema is maintained.
• External Services & Integrations:
• Email sending service via Postmark.
• Authentication with Lucia, including both social login (Google) and magic link.
• Payment processing through Stripe (endpoints exist under src/routes/stripe).
• Hosting/deployment on Vercel (with a vercel.json configuration).
• Database service using Turso.
Relationships and Interactions
• The Frontend interacts with the Backend through SvelteKit routes:
• The user interface defined in various Svelte components issues requests to API endpoints (e.g., for login, email verification, and handling Stripe events).
• The Backend handles authentication and authorization:
• Utilizes the Lucia library to authenticate users.
• Invokes email routines to send login links or verification messages.
• The Database layer is used for persisting user data, session tokens, and other state.
• Managed by Drizzle ORM with migration scripts provided under the drizzle folder.
• Communication to External Services happens as follows:
• When emails are sent (via the email module), the Postmark service API is triggered.
• During social login, Google Cloud’s OAuth endpoints are engaged.
• Payment events trigger interactions with Stripe’s API.
Architectural Patterns & Design Principles
• Separation of Concerns: The project isolates UI components, server logic, and database models into distinct folders.
• Serverless Architecture: Designed for quick deployment on Vercel, leveraging SvelteKit’s endpoints and serverless functions.
• Modular Component Architecture: All UI elements (buttons, forms, labels) are designed as reusable components.
• Clear API Boundaries: Different routes such as /login, /stripe, etc., have dedicated endpoints ensuring a clean separation between authentication, payment, and general app logic.
Relevant Technologies and Frameworks
• Svelte 5 & SvelteKit 2 – for building the reactive frontend and handling server routes.
• TailwindCSS and shadcn – for styling.
• Lucia – for authentication.
• Drizzle ORM paired with Turso – for database operations.
• Postmark – for email delivery.
• Stripe – for handling payments.
• Vercel – for serverless deployment.