Folder Structure
Docsta follows a simple and intuitive folder structure that aligns with best practices for Next.js and headless CMS integrations like Sanity. Here's an overview to help you navigate and customize your project with confidence.
Project Layout
my-docsta-project/
├── app/ or pages/ # Next.js routes (depending on routing setup)
│ └── docs/ # Dynamic route for documentation pages
├── components/ # Reusable UI components (e.g., Sidebar, Layout, MDXRenderer)
├── lib/ # Utility functions (e.g., Sanity fetchers, slug helpers)
├── public/ # Static assets like images, logos, favicons
├── sanity/ # Sanity Studio setup and schema definitions
│ ├── schemas/ # Sanity content types (e.g., doc.js, category.js)
│ └── sanity.config.ts # Sanity Studio configuration
├── styles/ # Global and module-level styles
├── .env.local # Environment variables for Sanity, etc.
├── next.config.js # Next.js configuration
└── README.md # Project documentationKey Folders Explained
app/orpages/
Handles your routing logic. In the docs folder, dynamic routes render content from Sanity based on the slug.
components/
Contains shared UI elements like navigation, layout wrappers, and content renderers.
lib/
Includes utility functions such as data fetching from Sanity (fetchDocs, fetchSidebar), or slug generators.
sanity/
Holds all Sanity-related files—schema definitions, configurations, and Studio setup. This is your content engine.
public/
Store logos, icons, and images here. These can be referenced in your documentation pages or layout.
styles/
Define your global Tailwind config or add custom CSS/SCSS modules here for overrides.
This modular setup keeps your code organized, scalable, and easy to maintain—perfect for building beautiful, performant docs at any scale.
👉 Next Up: Learn how to create and manage your documentation pages with Sanity or MDX.
What did you think of this content?
It was helpful
It was not helpful
I have a feedback