Project Structure
Overview of the MinuteShip template file and folder organization
MinuteShip follows a modular architecture based on TanStack Router with file-based routing, focusing on scalability and maintainability.
Root Directory Structure
src/api/: API route handlers and server logicauth/: Better Auth configuration and utilitiescache/: Server-side cache modulecomponents/: UI components organized by featureconfig/: Configuration files for the applicationdb/: Database schema, migrations, and utilitiesenv/: Environment variable validation (client/server)hooks/: Custom React hookslib/: Core application logic and utilitiesmail/: Email templates and sending modulelocale/: Paraglide middleware and generated runtimemiddlewares/: Route middlewaresnewsletter/: Newsletter subscription modulenotification/: Notification modulepayment/: Payment modulestorage/: File storage moduleroutes/: TanStack Router file-based routestypes/: TypeScript type definitionsstyles.css: Global styles and Tailwind CSS configuration
content/blog/: Blog posts in Markdown formatpages/: Custom pages in Markdown format (legal pages etc.)changelog/: Changelog entries in Markdown format
public/: Static assets served from the rootproject.inlang/: Locale configuration and messages/en.json, messages/zh.jsontests/: Vitest unit tests and Playwright E2E testsAGENTS.md: Project context and conventions for coding assistantsscripts/: Utility scriptsbiome.json: Biome linter and formatter configurationcontent-collections.ts: Content Collections configurationdrizzle.config.ts: Drizzle ORM configuration (remote)drizzle.config.local.ts: Drizzle ORM configuration (local)vitest.config.ts: Vitest unit test configurationplaywright.config.ts: Local browser test configurationplaywright.production.config.ts: Built Worker smoke test configurationvite.config.ts: Vite configurationwrangler.jsonc: Cloudflare Workers configuration (D1, R2, KV bindings)
Key Files
vite.config.ts: Vite configuration with TanStack Start, Cloudflare, Tailwind CSS, and Content Collections pluginswrangler.jsonc: Cloudflare Workers configuration including D1 database, R2 storage, and KV cache bindingscontent-collections.ts: Content Collections configuration for blog, legal pages, and changelogdrizzle.config.ts: Drizzle ORM configuration for the databasebiome.json: Biome linter and formatter configuration.env.example: Template for environment variables
Key Directories
/src/api Directory
Server-side API logic organized by feature:
ai.ts: Workers AI and fal.ai server functionscontact.ts: Contact form handlingnewsletter.ts: Newsletter subscription logicpayment.ts: Payment processing logicuser-files.ts: User file management logicusers.ts: User management logic
/src/lib Directory
Core application logic and utilities:
blog.ts: Blog utilitieschangelog.ts: Changelog utilitiesformatter.ts: Data formatting utilitiesmarkdown.ts: Markdown processing utilitiespages.ts: Pages utilitiesprice-plan.ts: Price plan utilitiesroutes.ts: Application route definitionsseo.ts: SEO metadata utilitiesurls.ts: URL-related utilitiesutils.ts: General utilities
/src/routes Directory
The routes directory follows TanStack Router file-based routing convention:
__root.tsx: Root layout with Navbar, Footer, ThemeProvider, Analytics, etc.index.tsx: Homepageauth/login.tsx: Login pageregister.tsx: Register pageforgot-password.tsx: Forgot password pagereset-password.tsx: Reset password pageerror.tsx: Auth error page
dashboard/index.tsx: Dashboard page
settings/index.tsx: Settings indexprofile.tsx: User profile settingssecurity.tsx: Security settingsbilling.tsx: Billing settingspayment.tsx: Payment settingsnotifications.tsx: Notification preferencesapikeys.tsx: API keys managementfiles.tsx: File management
admin/users.tsx: Admin user management
(pages)/pricing.tsx: Pricing pageabout.tsx: About pagecontact.tsx: Contact pagechangelog.tsx: Changelog pageroadmap.tsx: Roadmap pageai.tsx: AI playgroundwaitlist.tsx: Waitlist page
(legals)/privacy.tsx: Privacy policyterms.tsx: Terms of servicecookie.tsx: Cookie policy
blog/index.tsx: Blog listing page$slug.tsx: Blog post page
api/auth/$.ts: Better Auth API handler
webhooks/stripe.ts: Stripe webhook handlercreem.ts: Creem webhook handlerwaffo.ts: Waffo webhook handler
storage/file.ts: File upload/download handler
/src/components Directory
Components are organized by feature and purpose for better maintainability:
Shared Components
Shared components are reusable across the application and organized in dedicated directories:
ui/: Shadcn UI components like buttons, inputs, etc.blocks/: Marketing page blocks (homepage, features, etc.)layout/: Layout components like navbar, footer, etc.shared/: Other shared componentstheme/: Theme provider and toggleanalytics/: Analytics componentschatbox/: Chatbox components (Crisp)
Feature Components
The components directory is organized by feature, making it easy to locate and maintain components related to specific features like authentication, blog, dashboard, etc.
admin/: Admin panel componentsauth/: Authentication related componentsblog/: Blog related componentschangelog/: Changelog related componentscontact/: Contact related componentsdashboard/: Dashboard related componentspayment/: Payment related componentspricing/: Pricing related componentssettings/: User settings related componentswaitlist/: Waitlist related components
Next Steps
Now that you understand the project structure, explore these related topics:
- IDE Setup: Configure your development environment
- Environment Setup: Configure environment variables
- Getting Started: MinuteShip template getting started guide
- Updating the Codebase: Keep your project codebase up to date