Protokit

Get Started

Set up your development environment and start building with Datyze

Get Started

This guide will help you set up Datyze for local development.

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js 18.17 or later
  • pnpm 8.0 or later
  • PostgreSQL 14 or later (or use Docker)
  • Git

Installation

1. Clone the Repository

git clone https://github.com/idkbutimlucas/Datyze.git
cd Datyze

2. Install Dependencies

Datyze uses pnpm as its package manager:

pnpm install

3. Set Up Environment Variables

Copy the example environment file:

cp .env.example .env

Edit .env with your configuration:

# Database
DATABASE_URL="postgresql://user:password@localhost:5432/datyze"
 
# Authentication
AUTH_SECRET="your-auth-secret-min-32-chars"
AUTH_URL="http://localhost:3000"
NEXT_PUBLIC_APP_URL="http://localhost:3000"
NEXT_PUBLIC_APP_NAME="Datyze"
 
# OAuth Providers (optional)
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
GITHUB_CLIENT_ID=""
GITHUB_CLIENT_SECRET=""
Generate AUTH_SECRET using: openssl rand -base64 32

4. Set Up the Database

Start PostgreSQL (using Docker):

docker-compose up -d postgres

Push the database schema:

pnpm db:push

5. Start Development Server

pnpm dev

Your application will be available at http://localhost:3000.

Development Commands

CommandDescription
pnpm devStart development server
pnpm buildBuild for production
pnpm startStart production server
pnpm lintRun ESLint
pnpm lint:fixFix linting issues
pnpm formatFormat code with Prettier
pnpm type-checkRun TypeScript checks
pnpm testRun tests

Database Commands

CommandDescription
pnpm db:pushPush schema to database
pnpm db:generateGenerate migrations
pnpm db:migrateRun migrations
pnpm db:studioOpen Drizzle Studio

Project Structure

After installation, your project structure will look like this:

Datyze/
├── apps/
│   └── web/                  # Main Next.js application
│       ├── src/
│       │   ├── app/          # Next.js App Router
│       │   ├── components/   # React components
│       │   └── lib/          # Utility functions
│       └── public/           # Static assets
├── packages/
│   ├── auth/                 # @lucashochart/auth
│   ├── database/             # @lucashochart/database
│   ├── email/                # @lucashochart/email
│   ├── stripe/               # @lucashochart/stripe
│   ├── lemonsqueezy/         # @lucashochart/lemonsqueezy
│   └── ui/                   # @lucashochart/ui
└── docker-compose.yml

Next Steps

On this page