UNPKG

create-nextpress

Version:

Polyrepo architecture in a single monorepo

172 lines (127 loc) • 7.12 kB
<div align="center"> <a href="https://github.com/Nextpress-cc"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://foshati.storage.c2.liara.space/Nextpress.png"> <img alt="Nextpress logo" src="https://foshati.storage.c2.liara.space/Nextpress.png" height="150" style="border-radius: 12px;"> </picture> </a> <h1>NextPress v2.8.1</h1> <h3>Polyrepo architecture in a single monorepo</h3> <a href="https://www.npmjs.com/package/create-nextpress"><img alt="NPM version" src="https://img.shields.io/npm/v/create-nextpress.svg?style=for-the-badge&labelColor=000000&color=0066FF&borderRadius=8"></a> <a href="https://www.npmjs.com/package/create-nextpress"><img alt="Download Count" src="https://img.shields.io/npm/dt/create-nextpress.svg?style=for-the-badge&labelColor=000000&color=0066FF&borderRadius=8"></a> <a href="https://github.com/Nextpress-cc/create-nextpress/blob/main/LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-0066FF.svg?style=for-the-badge&labelColor=000000&borderRadius=8"></a> <a href="https://github.com/Nextpress-cc"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-Nextpress-0066FF.svg?style=for-the-badge&logo=github&labelColor=000000&logoWidth=20&borderRadius=8"></a> </div> # Create NextPress Fast to start, easy to build, ready for production ## Why NextPress ? šŸš€ NextPress implements true polyrepo architecture within a single repository structure, giving you: - šŸ—ļø **Polyrepo Benefits**: Independent frontend and backend codebases with separate dependencies - šŸ”„ **Single Repository Workflow**: The convenience of a monorepo with polyrepo architecture principles - 🧩 **Separation of Concerns**: Clear boundaries between Next.js frontend and Express backend - šŸ› ļø **Independent Versioning**: Each project can evolve at its own pace - ⚔ **Zero Configuration**: Immediate productivity with no manual setup - šŸ“± **Production-Ready Structure**: Best practices for enterprise application development ## Features ✨ - ⚔ **Next.js Frontend** with TypeScript & complete project structure - šŸš€ **Express Backend** with TypeScript, Prisma & API setup - šŸ“¦ **Polyrepo-in-Repo Structure**: Independent projects sharing one repository - šŸ”„ **Isolated Dependencies**: Each project manages its own packages - 🌐 **API-Ready**: Express configured for RESTful API development - šŸ”’ **Environment Setup**: Pre-configured dotenv for secure variable management - šŸ“Š **Database Integration**: Prisma ORM configured and ready for your models - šŸ› ļø **CLI Tool**: Includes `nextpressx` for streamlined development workflows - šŸ› ļø **Fast Development**: Start quickly with zero configuration needed ## Quick Start šŸš€ Create a new NextPress Monorepo project with a single command: ```bash npx create-nextpress ``` Or use with your preferred package manager: ```bash # Using npm npm create nextpress@latest # Using yarn yarn create nextpress # Using pnpm pnpm create nextpress # Using bun bunx create-nextpress ``` ## Step-by-Step Guide šŸ“ 1. Run the command above 2. Enter your project name (e.g., `my-awesome-project`) 3. Select your preferred package manager: - npm - yarn - pnpm - bun 4. Wait for automatic project structure creation 5. Install dependencies: ```bash cd my-project npm install # or yarn, pnpm install, bun install ``` 6. Start development: ```bash npm run dev # or yarn dev, pnpm dev, bun dev ``` 7. Open http://localhost:3000 for the frontend and http://localhost:3001 for the backend! ## Advanced Options āš™ļø ```bash # Create in current directory npx create-nextpress@latest . # Create with specific name npx create-nextpress@latest my-project # Enable debug mode to see detailed logs npx create-nextpress@latest my-project --debug # Check CLI version npx create-nextpress@latest --version ``` ## Project Structure ``` my-project/ # The single repository containing polyrepo architecture ā”œā”€ā”€ .env # Root environment variables ā”œā”€ā”€ apps/ # Applications directory │ ā”œā”€ā”€ client/ # Independent Next.js Frontend Project │ │ ā”œā”€ā”€ src/ # Source directory │ │ │ ā”œā”€ā”€ app/ # Next.js App Router │ │ │ └── ... # Additional source files │ │ ā”œā”€ā”€ next.config.ts # Next.js configuration │ │ ā”œā”€ā”€ package.json # Frontend's independent dependencies │ │ └── tsconfig.json # Frontend's TypeScript configuration │ │ │ └── server/ # Independent Express Backend Project │ ā”œā”€ā”€ src/ # Source directory │ │ ā”œā”€ā”€ server.ts # Express server entry point │ │ └── ... # Additional source files │ ā”œā”€ā”€ package.json # Backend's independent dependencies │ └── tsconfig.json # Backend's TypeScript configuration │ │ ā”œā”€ā”€ package.json # Root orchestration package.json (not a traditional workspace) └── README.md # Project documentation ``` Each project directory is a fully independent application that could be extracted to its own repository if needed in the future - true polyrepo architecture in a single repository. ## System Requirements šŸ“‹ - Node.js 18.0.0 or later - macOS, Windows, or Linux - Supported package manager (npm, yarn, pnpm, or bun) ## FAQ ### What is polyrepo architecture in a single monorepo? NextPress combines the best of both worlds: it structures your application as truly independent projects (polyrepo approach) but keeps them in one cohesive repository. Unlike traditional monorepos with shared dependencies and tight coupling, NextPress maintains complete isolation between frontend and backend with their own independent package.json files, dependencies, build processes, and deployment pipelines - all while providing the convenience of a single codebase. ### How does the frontend communicate with the backend? The frontend (Next.js) and backend (Express) are configured as separate applications that can communicate via API calls. The backend exposes RESTful API endpoints that the frontend can consume. ### Can I use NextPress for production applications? Absolutely! NextPress follows best practices for both frontend and backend development, making it suitable for production applications of any size. ### How can I customize the database connection? Edit the `pkg/prisma/schema.prisma` file to configure your database connection. NextPress supports PostgreSQL, MySQL, SQLite, SQL Server, MongoDB, and CockroachDB through Prisma. ## Contributing šŸ¤ We welcome contributions! Please see our [contributing guidelines](https://github.com/Nextpress-cc/create-nextpress/blob/main/CONTRIBUTING.md) for details. ## License šŸ“œ [MIT License](https://github.com/Nextpress-cc/create-nextpress/blob/main/LICENSE) --- <div align="center"> ✨ Built with ā¤ļø by the NextPress team ✨<br> <a href="https://github.com/Nextpress-cc">Nextpress.cc</a> </div>