ThlsPressThlsPress

Getting Started

Local Development Setup

Getting Started: Local Development Setup

This guide provides step-by-step instructions for setting up the THLSPress monorepo on your local machine for development and contribution.

Prerequisites

Before you begin, ensure you have the following software installed:

  • Node.js: LTS version (v18 or newer recommended).
  • PNPM: The required package manager for this monorepo. Install it globally:
    npm install -g pnpm
  • Git: For version control.
  • Database: A running MySQL server instance.
  • Docker (Optional): A docker-compose.yml file can be provided to easily spin up a development database.

Step-by-Step Installation

  1. Clone the Repository: Clone the entire monorepo from GitHub to your local machine.

    git clone https://github.com/thelolos/thlspress-cms.git
    cd thlspress-cms
  2. Configure Environment Variables: The Core CMS (/cms) requires a .env file for database credentials and application secrets. Copy the example file and fill in your details.

    cp cms/.env.example cms/.env

    Open cms/.env and update the DATABASE_URL and NEXTAUTH_SECRET variables.

  3. Install All Dependencies: From the root directory of the monorepo (thlspress-cms/), run the pnpm install command.

    pnpm install

    PNPM will read the pnpm-workspace.yaml file, identify all packages (cms, cli, etc.), and install their dependencies into a single, shared node_modules directory at the root.

  4. Synchronize the Database Schema: THLSPress uses Prisma as its ORM. To apply the database schema defined in cms/prisma/schema.prisma to your MySQL database, run the following command from the root:

    pnpm --filter cms prisma db push

    Note: The --filter cms flag instructs PNPM to execute the command specifically within the cms package. This will create all the necessary tables for the core system.

  5. Run the Development Server: To start the Next.js development server for the CMS, run the dev script from the root directory:

    pnpm dev

    This command utilizes Turborepo to find and execute the dev script defined in cms/package.json. The application will be available at http://localhost:3000.

You now have a fully functional local development environment for THLSPress.