Project Structure

Project Structure

NextDevTpl uses a feature-based structure. Routes live under src/app, reusable product modules live under src/features, and infrastructure helpers live under src/lib.

Top-level files

PathPurpose
package.jsonScripts and dependency versions
next.config.mjsNext.js, MDX, and build configuration
source.config.tsFumadocs content collections
drizzle.config.tsDrizzle migration configuration
.env.exampleEnvironment variable reference
deploy-build.batWindows-side production build and upload script
start-prod.shLinux production start script

Application routes

src/app/
├── [locale]/
│   ├── (marketing)/     # Home, blog, legal, PSEO, public pages
│   ├── (auth)/          # Sign in, sign up, password reset
│   ├── (dashboard)/     # Authenticated customer dashboard
│   ├── (admin)/         # Admin-only area
│   └── docs/            # Fumadocs documentation
└── api/                 # Route handlers and webhooks

The locale segment is handled by next-intl. Current locales are configured in src/i18n/routing.ts.

Feature modules

ModuleMain purpose
src/features/authAuth UI and client hooks
src/features/creditsCredit ledger, purchases, and balance utilities
src/features/paymentCreem checkout and payment actions
src/features/subscriptionUser plan lookup and subscription UI
src/features/settingsProfile, security, billing, and account settings
src/features/supportUser tickets and admin replies
src/features/adminAdmin UI components
src/features/marketingHeader, footer, hero, pricing, FAQ, and landing sections
src/features/storageS3/R2 upload and provider abstraction
src/features/mailReact Email templates and send actions
src/features/sharedProviders, theme toggle, language switcher, shared icons

Infrastructure modules

PathResponsibility
src/db/schema.tsDatabase tables and relations
src/lib/authBetter Auth server, client, edge helpers, and admin helpers
src/lib/rate-limitUpstash-backed rate limiting with safe fallback
src/lib/loggerPino logger wrapper and Axiom integration
src/lib/monitoringSentry integration helpers
src/lib/source.tsFumadocs, blog, and legal content loaders
src/lib/safe-action.tsServer Action client setup
src/inngestInngest client and background functions

Content

PathContent type
src/content/docs/enEnglish documentation
src/content/docs/zhChinese documentation
src/content/blog/enEnglish blog posts
src/content/blog/zhChinese blog posts
src/content/legal/enEnglish legal pages
src/content/legal/zhChinese legal pages
messages/en.jsonEnglish UI translations
messages/zh.jsonChinese UI translations

Testing

Integration tests live under src/test. They cover payment, credits, support tickets, storage security, settings, jobs, and email flows.

On this page