Skip to content

Repository files navigation

Foundations

Foundations is an opinionated collection of components, patterns, and guidelines for building consistent and accessible user interfaces. Inspired by projects like shadcn, the goal is to allow developers to copy components into their projects and customize them as needed, or simply take inspiration to build their own versions.


Table of Contents


Getting Started

  1. Clone the repository:

    git clone https://github.com/significa/foundations.git
    cd foundations
  2. Enable pnpm via Corepack:

    This project uses pnpm (version pinned in package.json via packageManager). Node version is specified in .nvmrc.

    corepack enable pnpm
  3. Install dependencies:

    pnpm install
  4. Set up environment variables (optional):

    The project ships with no required environment variables. PostHog analytics is the only thing that uses them, and if POSTHOG_KEY / POSTHOG_HOST aren't set, the analytics init is skipped at runtime — local development works without a .env file.

    To enable analytics, copy .env.example to .env and fill in real values.

  5. Start the dev server:

    pnpm dev

    The site will be available at http://localhost:4321.

    Search uses Pagefind, which indexes the production HTML. pnpm dev does not index — open the search dialog and you'll see a hint to run pnpm dev:pagefind instead, which builds, indexes into public/pagefind/, and starts the dev server. Subsequent pnpm dev runs reuse that index until you wipe public/pagefind/.


Authoring

Documentation pages are written in .mdx format. All content is driven by Astro Content Collections, defined in src/content.config.ts.

Folder Structure

The src/foundations folder contains all the foundational content and follows a specific convention:

  • page.mdx: Used to create the documentation page.
  • Source files are added to the root of the folder.
  • Any file ending in .preview.tsx will be made available as a preview (see "Code Previews" below).

Pages

Each page.mdx file should include the following metadata structure:

FieldTypeDescriptionRequired
titleStringThe title of the docs page.Yes
descriptionStringA brief description of the docs page.Yes
previewStringThe slug of a "Code Preview" to be used as a cover.No
filesArrayList of source files.No
dependenciesArrayList of dependencies, each with a name and href.No
folderStringUsed for sidebar organization.No

Dependencies Structure

Each dependency in the dependencies array should have the following structure:

FieldTypeDescriptionRequired
nameStringThe name of the dependency.Yes
hrefStringURL to the dependency.Yes

This metadata is crucial for ensuring that each documentation page is properly structured and provides all necessary information.

Code Previews

While developing, you can visit /preview/[slug] to open a [slug].preview.tsx file. This makes it easier to develop in isolation.

A preview file can optionally export a meta object to control how it is displayed.

OptionValuesDefaultDescription
layout'centered''fullscreen''padded''centered'Controls how the preview is framed inside its container
mode'inline''iframe''iframe'Whether the preview renders inline or inside an iframe in docs pages

Commands

CommandDescription
pnpm devStart the Astro development server
pnpm dev:pagefindBuild the site and start a dev server with Pagefind search working
pnpm buildBuild for production (includes Pagefind indexing via postbuild)
pnpm previewPreview the production build locally
pnpm types:checkRun astro sync and TypeScript type checking
pnpm formatAuto-format all files (Biome for TS/TSX/CSS, Prettier for .astro)
pnpm lintRun Biome linter with auto-fix (including unsafe fixes)
pnpm checkFull CI check: Biome CI + Prettier check on .astro + type checking

Note:pnpm dev does not index Pagefind, so the search dialog will show a "Could not load Pagefind instance" message. Run pnpm dev:pagefind once to build the index — subsequent pnpm dev runs will pick it up from public/pagefind/.


Stack

ToolPurpose
AstroCore framework — static site generation, routing, MDX, content collections
React 19Interactive islands (component previews, search, menus, etc.)
Tailwind CSS v4Utility-first styling via the Vite plugin
MDXMarkdown + JSX for content pages (page.mdx files)
PagefindStatic full-text search, indexed at build time
Phosphor IconsIcon library
ShikiSyntax highlighting (themes: kanagawa-lotus / github-dark)

Linting & Formatting

This project uses both Biome and Prettier — by design, not by accident.

Biome does not yet support .astro files. Prettier, with the prettier-plugin-astro plugin, fills that gap. Once Biome adds support for .astro files, we should remove Prettier and consolidate on Biome for all formatting and linting needs.

License

This project is licensed under the GPL-3.0 License.

Acknowledgments

Shadcn and Lucia Auth serve as excellent examples of robust foundational platforms that people can use to build upon. This project aspires to combine the strengths of both by offering ready-to-use components alongside detailed guides and recipes, simplifying the process of kickstarting any project.


For more details, refer to the codebase and explore the components and patterns provided.

Built by Significa.

Used by

Contributors

Languages