Project Structure
Understand how Starter Free is organized so you can extend it without breaking its architecture.
OverviewLink to section
Starter Free is structured for clarity and long-term evolution.
This is not a demo folder. It is a production-shaped architecture designed to help you extend features without turning pages into large, fragile files.
Understanding the structure early helps you:
- extend features cleanly
- keep routes readable
- wire backend progressively
- avoid refactors caused by mixed responsibilities
Key idea
You are not only learning where files live. You are learning how product architecture scales from a mocked SaaS surface to a real product.
Mental modelLink to section
Pages define routes. Components define features. UI defines primitives.
| Layer | Responsibility |
|---|---|
app/ | Routing, layouts, and product entry points |
components/ | Feature composition and interaction logic |
@pycolors/ui | Stateless UI primitives used across the product |
System rule
Keep pages thin. When interaction logic grows, move it into a feature folder.
First customization pointsLink to section
Paths here are relative to your Starter Free checkout. In the source monorepo,
that checkout is apps/starter-free; do not import private monorepo packages
into the independently delivered starter.
| File | Start here for |
|---|---|
app/layout.tsx | App name, page metadata, and the root document |
app/(app)/layout.tsx | App-header branding and the application shell |
app/globals.css | Styles and semantic tokens for both themes |
lib/getting-started.ts | The dashboard's informational guide content and links |
components/app/app-sidebar.tsx | Desktop application navigation |
Keep the appearance bootstrap and existing theme control when changing branding. The dashboard guide does not track completion or own project state. Try the first-session workflow before changing the project feature.
StructureLink to section
This structure is intentionally small. It separates route ownership from feature composition.
Architecture flowLink to section
App Router pages
↓
Feature components
↓
PyColors UI primitivesA page should describe the product surface. Feature components should own interactions. UI primitives should stay reusable and stateless.
Route layer
The route layer defines URLs, page structure, layout composition, and high-level orchestration.
App directoryLink to section
The app/ directory is the routing layer. The (app) route group provides the
application shell without adding (app) to the URL. For example,
app/(app)/projects/page.tsx serves /projects, and the nested [id]/page.tsx
serves a real project ID selected from the list.
app/(app)/projects/layout.tsx mounts ProjectProvider for both the list and
detail routes. Keep this shared boundary so navigation does not create a
second, disconnected project store. The dashboard remains a Server Component;
the existing Projects page and provider use a client boundary for local state.
It defines:
- auth entry points
- dashboard pages
- product routes
- settings and billing surfaces
- high-level layout composition
Page rule
A page should compose the feature. It should not become the feature itself.
Components directoryLink to section
The components/ directory contains feature-level building blocks.
For example, the projects feature keeps its browser-local provider, table rendering, row actions, dialogs, and sample types together.
A focused composition excerpt from the Projects page passes the current state and callbacks to the table:
"use client";
import { ProjectTable } from "@/components/projects/project-table";
import { useProjects } from "@/components/projects/project-provider";
export function ProjectList() {
const { projects, isLoading, renameProject, deleteProject } = useProjects();
return (
<ProjectTable
projects={projects}
isLoading={isLoading}
onRename={renameProject}
onDelete={deleteProject}
/>
);
}This excerpt is not a replacement for the complete delivered page. Preserve its
create/reset controls, storage notice, details links, and PageShell. Render
such a consumer only beneath the existing ProjectProvider; useProjects
throws outside that context. Reuse the delivered dialogs and row actions
instead of replacing them with placeholder components.
Mock data strategyLink to section
The project samples are initial/reset data, not the only source of truth after a user edits a project. The current flow is:
ProjectProvider
-> read saved browser-local projects (or initial samples)
-> expose projects, loading, storage notice, and mutation callbacks
-> create / rename / delete -> update state and attempt localStorage write
-> confirmed Reset demo -> replace local projects with original samplescomponents/projects/project-types.ts owns the complete Project type and
MOCK_PROJECTS. Reuse that type instead of copying a reduced interface.
components/projects/project-provider.tsx owns React state and mutations;
lib/project-storage.ts owns reading/writing stored project records.
Changing MOCK_PROJECTS does not replace a valid saved project collection.
Use the confirmed Reset demo action only when you intend to discard local
changes. Invalid saved data falls back to samples with a notice. When browser
storage is unavailable, changes remain in memory for the current visit only.
This is not a shared database, authentication, or cross-device synchronization.
Later, replace this browser-local persistence boundary with your own server-side validation, authorization, and database-backed project operations. Keep the presentation components separate from that product-specific integration.
PageShell patternLink to section
Main SaaS pages use a shared shell for consistent page structure.
import { PageShell } from "@/components/app/page-shell";
export function ReportsPreview() {
return (
<PageShell title="Reports" description="Explore your report layout.">
<p>No reports yet.</p>
</PageShell>
);
}Use this pattern to keep:
- page spacing consistent
- headers predictable
- actions aligned
- metadata structured
Do not bypass it unless the page truly needs a different layout.
Dialog patternLink to section
Dialogs are isolated from the page and controlled by their parent feature.
Recommended ownership:
| Concern | Owner |
|---|---|
| Open state | Parent feature component |
| Form UI | Dialog component |
| API call later | Feature/service layer |
| Visual primitive | @pycolors/ui Dialog |
This makes rename and delete flows easier to wire later without changing page structure.
Add a new featureLink to section
Start with a static route in the existing application shell. These are new example files to create in your checkout, not files already included in Free. No backend or permission model is introduced by this example.
Add the routeLink to section
mkdir -p 'app/(app)/reports' components/reportsUse the quoted route-group path so the new page shares the application layout.
Create the feature folderLink to section
Save this component in components/reports/report-panel.tsx:
export function ReportPanel() {
return <p>No reports yet. Connect your own report data when ready.</p>;
}Compose the pageLink to section
Save the route in app/(app)/reports/page.tsx:
import { PageShell } from "@/components/app/page-shell";
import { ReportPanel } from "@/components/reports/report-panel";
export default function ReportsPage() {
return (
<PageShell title="Reports" description="Your product reports.">
<ReportPanel />
</PageShell>
);
}Open /reports in the running starter. Both files can remain Server Components;
add a client leaf only when real interaction requires it. Run the checks in your
checkout's package scripts before committing your customization.
Decision guideLink to section
Use the Starter Free structure if:
- you want thin route files
- features need to evolve independently
- mock data will later become backend data
- dialogs and row actions need to stay reusable
- you want a clear path from frontend surface to production wiring
Avoid changing the structure if:
- you have not explored the full vertical slice yet
- the change only saves a few lines today
- the route would start owning too much logic
- UI primitives would start fetching data
- the mock layer would become scattered globally
Prefer
- feature-based folders
- thin pages
- mock data close to the feature
- isolated dialogs and row actions
- UI primitives that stay stateless
Avoid
- putting feature logic directly in pages
- fetching data inside UI primitives
- placing all mock data in one global file
- duplicating dialog logic across routes
- deleting structure before understanding it
Backend wiring laterLink to section
When you connect a backend, the structure stays familiar.
| Today | Later |
|---|---|
| Browser-local project provider and storage | Your authorized, database-backed project operations |
| local dialog state | server action or API mutation |
| disabled billing portal | Stripe billing portal |
| mocked auth screens | real auth provider |
| static members | organization members from backend |
The goal is to reuse the presentation while implementing a real product boundary, not simply substitute a database call for local storage. Starter Pro supplies configurable connected foundations, not automatic migration of Free projects. Review what is included and the upgrade guide before planning your integration.
Upgrade when wiring becomes the blocker
Starter Free validates the product surface. Starter Pro wires the business
layer with production-shaped auth, billing, backend, and delivery foundations.
→ /docs/starter-pro