We are launching v2: only $99 during beta phase.

DirectoryStack Logo Light Mode

You are currently viewing the v2 documentation.
You can view the v1 documentation here.

General

The project structue of v2 is a complete redo compared to v1. We decided to go with a more modular approach to make the project more maintainable and easier to understand.

The project is structured like a Next.js 15 project which is using the modern /app folder. However, we use a module(or feature)-based folder structure to make the project more maintainable and easier to understand.

This is in contrast to v1 where the project was using a type-based folder structure (like all server actions in one folder - no matter what is this server action used for).

In v2, we put all files related to a certain feature/module in the same folder. This way you can quickly understand what a certain feature is about by looking at the standardized folder structure.

First let's understand the folder structure of a module:

  • module-name/
    • src/
      • actions/ (server actions)
      • components/ (components)
      • data/ (data fetching functions)
      • db/ (database migrations and seeds)
      • locales/ (locales)
      • pages/ (pages)
      • types/ (custom typescript types)
      • utils/ (helper functions)
      • config.ts (module config)
    • package.json
    • README.md

Not all folders are required for every module. For example, if a module does not have any server actions, the actions folder was removed.

A module's folder is in one of three places:

  • __core/ (core modules: A core module is a key building block of a directory. These are the main features of a directory. Every directory will use every core module.)
  • __extensions/ (extensions modules: An extension module is a module that extends the functionality of a directory with specific features. We believe not every directory will need every extension module.)
  • __shared/ (shared modules: A shared module is a module that is used by multiple core modules and does not have any core functionality itself.)

Core and shared modules together form the "Foundation" of a directory, and of DirectoryStack. We call the Foundation an the extensions modules the "Foundation Plus".

In any case, here is what the file tree looks like when you clone the project:

  • app
    • __core/
      • module-name-1/
      • module-name-2/
      • ...
    • __extensions/
      • (Explanation: If you purchase the "Foundation", this folder will be empty)
      • module-name-1/
      • module-name-2/
      • ...
    • __shared/
      • module-name-1/
      • module-name-2/
      • ...
    • [locale] (Explanation: All pages are translated and thus we have a catch-all route on top.)
      • (Admin) (Explanation: This folder houses all admin pages.)
      • (Protected) (Explanation: This folder houses all protected pages.)
      • (Public) (Explanation: This folder houses all public pages.)
        • (auth) (Explanation: Page Group of all auth-related pages)
        • (legal) (Explanation: Page Group of all legal-related pages)
        • ... some other routes
      • api (Explanation: API-related routes)
        • module-name-1 (Explanation: e.g. auth)

As this is a Next.js 15 project, this boilerplate, of course, comes with a lot of other files and folders. We made sure to use all Next.js 15 best practices, including automatic sitemap generation through sitemap.ts, middleware instrumentation, etc.

Interested in kickstarting your directory business?

Get the latest news, guides and changelog updates straight to your inbox.

By signing up, you agree to our Privacy Policy