About The Project β’ Key Features β’ Tech Stack β’ Project Structure β’ Getting Started
Altrp is a modern, type-safe, and high-performance monorepo for building web applications. It consists of 4 main projects:
- π± site - Static website (Next.js 15, React 19, Tailwind CSS 4)
- ποΈ cms - Admin panel with MDX support
- π€ bot - AI agents and Telegram bots with SQLite
- ποΈ app - Payload Backend with PostgreSQL
The project is built with a strong focus on Developer Experience (DX) and scalability, leveraging the best tools from the modern web ecosystem.
- β‘οΈ Blazing Fast Performance: Powered by Bun and Next.js App Router with Server Components.
- π Git-Powered CMS: All content is version-controlled in the repository and easily editable.
- βοΈ Built-in Editor: Edit MDX content directly in the browser with a Tiptap-based editor.
- π‘οΈ End-to-end Type Safety: TypeScript throughout, with schema validation for content and forms via Zod.
- π Internationalization (i18n) Ready: Built-in support for multiple languages with
next-intl. - π¨ Flexible UI Customization: Components built with shadcn/ui and styled with Tailwind CSS 4.
- π Lightning-Fast Search: Client-side content search powered by Fuse.js.
- π SEO Optimized: Automatic sitemap generation, RSS feeds, and metadata management with
next-seo. - π οΈ Superior Developer Experience: Linting, formatting, Git hooks, and code generation out-of-the-box.
This project uses a carefully curated set of technologies to achieve maximum efficiency and a great developer experience.
| Technology | Purpose |
|---|---|
| Bun | An incredibly fast JavaScript runtime, bundler, and package manager. |
| Next.js | The React Framework with App Router for hybrid and server rendering. |
| TypeScript | Strict typing for code reliability and scalability. |
| Tailwind CSS 4 | A utility-first CSS framework for rapid and consistent styling. |
| Git-as-CMS | The strategy of using Git as a version-controlled content database. |
| Repository Pattern | A design pattern to abstract data access logic from the application. |
| Zustand | A minimalistic and powerful state management solution. |
| Technology | Purpose |
|---|---|
| Shadcn/ui | Not a library, but a collection of reusable, customizable components. |
| Lucide React | Beautiful and consistent open-source icons. |
| next-themes | Theme management (light/dark mode) integrated with Next.js. |
| Tremor | Components for building insightful dashboards in the CMS. |
| Sonner | An elegant and simple toast notification library. |
| Technology | Purpose |
|---|---|
| MDX | A content format that lets you use React components in Markdown. |
| next-mdx-remote | A powerful tool for rendering MDX strings. |
| Zod | Schema validation for MDX frontmatter and form data. |
| Fuse.js | A lightweight fuzzy-search library for client-side search. |
| TipTap | A headless editor framework for creating custom WYSIWYG experiences. |
| Technology | Purpose |
|---|---|
| React Hook Form | Performant and flexible form management. |
| Husky + lint-staged | Automatically run linters and tests before each commit. |
| ESLint + Prettier | Enforcing consistent code style and catching errors. |
This is a monorepo with 4 main applications:
altrp/
βββ apps/
β βββ site/ # Static website (port 3100)
β βββ cms/ # MDX or SQLlite Admin panel (port 3200)
β βββ bot/ # AI bots (port 3300)
β βββ app/ # Payload CMS (port 3000)
βββ packages/
β βββ components/ # Shared UI components
β βββ lib/ # Shared utilities
β βββ content/ # Shared content (MDX, locales)
βββ settings.ts # Global configuration
| Command | Description |
|---|---|
bun run dev |
Run all projects |
bun run dev:site |
Run site only |
bun run dev:cms |
Run CMS only |
bun run dev:bot |
Run bot only |
bun run dev:app |
Run app only |
bun run build:site |
Build site for production |
bun run build:cms |
Build CMS for production |
Follow these steps to get the project running locally.
# Create a new repository on GitHub
# Name: <YOUR_PROJECT># Open Cursor and terminal
git clone https://github.com/GTFB/altrp <YOUR_PROJECT>
cd <YOUR_PROJECT># Change origin to your repository
git remote set-url origin https://github.com/<YOUR_ORG>/<YOUR_PROJECT>
git remote -v
git push -u origin main- Open Cloudflare Dashboard
- Go to Pages β Create a project
- Connect GitHub and select
<YOUR_PROJECT> - Configure build settings:
- Build command:
bun run build:static - Build output:
dist - Root directory:
apps/site - Build comments:
Enabled
- Build command:
This project uses Bun. If you don't have it installed, please install it first.
bun install# If this is not your first project, change port in apps/site/package.json
# Change 3100 to 3101, 3102, etc.# Run site only
cd apps/site
bun run dev
# Or run all projects
bun run devOpen http://localhost:3100 in your browser.
- Open site in hot reload mode:
http://localhost:3100 - All changes are visible in real time
- Edit components in
apps/site/components/
# Stop server
taskkill /F /IM node.exe
# Restart
bun run dev# Add changes
git add .
# Create commit
git commit -m "feat: added new features"
# Push changes
git push origin main
# Watch deployment in Cloudflare Pages
# Check changes on productionbun dev: Runs the app in development mode.bun build: Builds the app for production.bun start: Starts the production server.bun lint: Lints the codebase with ESLint.bun format: Formats the code with Prettier.bun test: Runs unit tests.
| Command | Make | NPM/Bun | Description |
|---|---|---|---|
| Run site dev server | make dev-site |
bun run dev:site |
Start the site application in development mode |
| Run CMS dev server | make dev-cms |
bun run dev:cms |
Start the CMS application in development mode |
| Run app dev server | make dev-app |
bun run dev:app |
Start the app application in development mode |
| Run all apps concurrently | make dev-all |
bun run dev |
Start all applications simultaneously in development mode |
| Command | Make | NPM/Bun | Description |
|---|---|---|---|
| Build site | make build-site |
bun run build:site |
Build the site application for production |
| Build CMS | make build-cms |
bun run build:cms |
Build the CMS application for production |
| Build app | make build-app |
bun run build:app |
Build the app application for production |
| Build all apps | make build-all |
bun run build |
Build all applications for production |
| Start site | make start-site |
bun run start:site |
Start the site application in production mode |
| Start CMS | make start-cms |
bun run start:cms |
Start the CMS application in production mode |
| Start app | make start-app |
bun run start:app |
Start the app application in production mode |
| Command | Make | NPM/Bun | Description |
|---|---|---|---|
| Quick E2E tests | make quick-test |
bun run quick-test |
Run quick end-to-end tests for CMS public pages |
| Command | Make | NPM/Bun | Description |
|---|---|---|---|
| Install dependencies | make install |
bun install |
Install all project dependencies |
| Initialize project | make init |
- | Initialize all project configurations (ESLint, Prettier, Husky, etc.) |
| Generate .env file | make env |
- | Generate .env file from example.env with auto-generated NEXTAUTH_SECRET |
| Generate component | make component NAME=ComponentName |
bun hygen component new --name ComponentName |
Generate a new React component using Hygen |
| Command | Make | NPM/Bun | Description |
|---|---|---|---|
| Run linter | make lint |
bun run lint |
Run ESLint to check code quality |
| Format code | make format |
bun run format |
Format code using Prettier |
| Run tests | make test |
bun test |
Run unit tests with Bun |
The Payload collections in apps/app/src/collections serve as the single source of truth for the database schema. All database changes should originate from these collection definitions.
When adding or modifying database columns, follow this workflow:
-
Pull Latest Changes
git pull origin main
β οΈ Important: Always pull the latest version before creating migrations to avoid conflicts, especially since multiple migration files may already exist. -
Modify Collection Schema
- Add or update fields in the appropriate collection file in
apps/app/src/collections
- Add or update fields in the appropriate collection file in
-
Generate Payload Migration
bun run db:app:generate
This command generates Payload migration files based on schema changes.
-
Generate SQL Migration
bun run db:site:migrate:local
This command creates the SQL migration file that will be applied to the database.
| Command | Description |
|---|---|
bun run db:app:generate |
Generate Payload migrations from collection schema changes |
bun run db:site:migrate:local |
Generate SQL migration file for local database |
- Always work with the latest codebase to prevent migration conflicts
- Test migrations locally before committing
- Never manually edit the database schema outside of Payload collections
- Keep migration files in version control
- Review generated migration files before applying them
To access the admin panel and manage content:
- Authentication Setup: Configure your authentication provider in
.env.local - Admin Role: Currently, admin access is hardcoded for testing (see
AdminGuard.tsx) - Access Admin Panel: Navigate to
/adminafter authentication
The project provides several API endpoints for content management:
GET /api/admin/blog- Get all blog posts with paginationPOST /api/admin/blog- Create a new blog postPUT /api/admin/blog/[slug]- Update a blog postDELETE /api/admin/blog/[slug]- Delete a blog post
GET /api/authors- Get all authorsGET /api/categories- Get all categories
GET /api/posts- Get published postsGET /api/rss- RSS feed for blog posts
Use the built-in code generator to create new React components:
bun hygen component new --name ComponentName- Blog Posts: Add MDX files to
content/blog/[slug]/index.mdx - Pages: Add MDX files to
content/pages/[slug].mdx - Authors: Add MDX files to
content/authors/[slug].mdx - Categories: Add MDX files to
content/categories/[slug].mdx
- Start Development:
bun dev - Access Admin: Go to
http://localhost:3000/admin - Create Content: Use the admin interface or add MDX files directly
- Preview Changes: Content updates automatically in development mode
Contributions are welcome! Please see CONTRIBUTING.md for more details on how to get started.
This project is licensed under the MIT License. See the LICENSE file for details.
