Installation Guide

Step-by-step installation and setup guide for Litestore

Prerequisites

Before installing Litestore, ensure you have the following:

System Requirements

  • Node.js 18.17.0 or later (Node.js 23.1 may have issues with Next.js production builds)
  • Git for version control
  • PostgreSQL 13+ for the database
  • 4GB RAM minimum (8GB recommended for development)
  • Redis for session storage and caching (development and production)
  • OpenAI API Key for AI features
  • Cloudinary Account for image storage and optimization
  • SMTP Service for email notifications

A minimum version of Node.js 18.17.0 is required. We recommend using the latest LTS version for the best experience.

Installation Options

Litestore offers multiple installation methods to fit your development workflow and deployment needs.

Using the CLI

The fastest way to get started is with our interactive CLI:

npx create-litestore-app@latest my-store
pnpm create litestore-app@latest my-store
yarn create litestore-app@latest my-store
bun create litestore-app@latest my-store

The CLI will guide you through:

  • Project naming
  • Database configuration (PostgreSQL recommended)
  • AI service setup (OpenAI API key)
  • Initial admin user creation

Manual Installation

For advanced users or custom setups:

1. Clone the Repository

git clone https://github.com/your-org/litestore.git
cd litestore

2. Install Dependencies

npm install
# or
pnpm install
# or
yarn install
# or
bun install

3. Environment Configuration

Create a .env.local file in the root directory:

# Database
DATABASE_URL="postgresql://username:password@localhost:5432/litestore"

# Authentication
NEXTAUTH_SECRET="your-secret-key-here"
NEXTAUTH_URL="http://localhost:3000"

# AI Services (Optional)
OPENAI_API_KEY="sk-your-openai-key"

# Email (Optional)
SMTP_HOST="smtp.gmail.com"
SMTP_PORT="587"
SMTP_USER="your-email@gmail.com"
SMTP_PASS="your-app-password"

# Payment (Optional)
STRIPE_SECRET_KEY="sk_test_..."
STRIPE_PUBLISHABLE_KEY="pk_test_..."

# File Storage (Optional)
CLOUDINARY_CLOUD_NAME="your-cloud-name"
CLOUDINARY_API_KEY="your-api-key"
CLOUDINARY_API_SECRET="your-api-secret"

4. Database Setup

# Generate Prisma client
npx prisma generate

# Run database migrations
npx prisma migrate dev

# (Optional) Seed with sample data
npx prisma db seed

5. Start Development Server

npm run dev

Visit http://localhost:3000 to access your store.

Production Deployment

Environment Variables

For production, ensure these additional variables are set:

NODE_ENV="production"
NEXTAUTH_URL="https://yourdomain.com"
DATABASE_URL="postgresql://user:pass@prod-host:5432/litestore"

Build and Deploy

# Build for production
npm run build

# Start production server
npm start
  1. Connect your GitHub repository
  2. Set environment variables in Vercel dashboard
  3. Deploy automatically on git push

Railway

  1. Connect GitHub repo
  2. Database is auto-provisioned
  3. Environment variables set in dashboard

Docker

FROM node:18-alpine

WORKDIR /app

COPY package*.json ./
RUN npm ci --only=production

COPY . .

RUN npm run build

EXPOSE 3000

CMD ["npm", "start"]
docker build -t litestore .
docker run -p 3000:3000 litestore

Configuration Options

Database Configuration

Litestore supports PostgreSQL with Prisma ORM:

// prisma/schema.prisma
datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

AI Services Configuration

Configure AI features in config/ai.config.ts:

export const aiConfig = {
  openai: {
    apiKey: process.env.OPENAI_API_KEY,
    models: {
      contentGeneration: "gpt-4",
      moderation: "gpt-3.5-turbo",
      analysis: "gpt-4"
    }
  },
  rateLimits: {
    contentGeneration: 10, // requests per minute
    moderation: 100,
    analysis: 50
  }
}

File Storage Configuration

Choose from multiple storage providers:

// config/storage.config.ts
export const storageConfig = {
  provider: "cloudinary", // or "aws-s3", "vercel-blob"
  cloudinary: {
    cloudName: process.env.CLOUDINARY_CLOUD_NAME,
    apiKey: process.env.CLOUDINARY_API_KEY,
    apiSecret: process.env.CLOUDINARY_API_SECRET
  }
}

Email Configuration

Set up email delivery for notifications:

// config/email.config.ts
export const emailConfig = {
  provider: "smtp", // or "sendgrid", "mailgun", "resend"
  smtp: {
    host: process.env.SMTP_HOST,
    port: parseInt(process.env.SMTP_PORT || "587"),
    auth: {
      user: process.env.SMTP_USER,
      pass: process.env.SMTP_PASS
    }
  }
}

Post-Installation Setup

Admin User Creation

  1. Visit your store at http://localhost:3000
  2. Click "Sign Up" to create the first admin account
  3. The first user automatically becomes an admin

Basic Store Configuration

  1. Store Settings: Set store name, description, and branding
  2. Payment Setup: Configure Stripe or other payment providers
  3. Shipping Rules: Set up shipping zones and rates
  4. Tax Configuration: Configure tax rates and rules

Creator System Setup

  1. Creator Registration: Enable creator sign-ups
  2. Verification Settings: Configure domain and social verification
  3. Commission Rules: Set up default commission structures
  4. Content Guidelines: Create submission guidelines for creators

AI Feature Configuration

  1. API Keys: Add OpenAI API key for AI features
  2. Content Templates: Configure AI content generation settings
  3. Moderation Rules: Set up automated content moderation
  4. Rate Limits: Configure API usage limits

Troubleshooting

Common Installation Issues

Database Connection Failed

# Check if PostgreSQL is running
brew services list | grep postgresql

# Reset database
npx prisma migrate reset

# Regenerate client
npx prisma generate

Build Errors

# Clear Next.js cache
rm -rf .next

# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install

# Check Node.js version
node --version # Should be 18+

Environment Variables Not Loading

# Check if .env.local exists
ls -la .env.local

# Restart development server
npm run dev

Performance Optimization

Database Indexing

-- Add recommended indexes
CREATE INDEX idx_products_category ON products(category_id);
CREATE INDEX idx_content_creator ON creator_content(creator_id);
CREATE INDEX idx_reviews_product ON reviews(product_id);

Caching Setup

// config/cache.config.ts
export const cacheConfig = {
  redis: {
    url: process.env.REDIS_URL
  },
  ttl: {
    products: 3600, // 1 hour
    content: 1800,  // 30 minutes
    analytics: 300  // 5 minutes
  }
}

Next Steps

After successful installation:

  1. Explore the Dashboard: Familiarize yourself with the admin interface
  2. Add Products: Create your first products with AI-generated descriptions
  3. Invite Creators: Set up creator accounts and content submission
  4. Configure Analytics: Set up tracking and reporting
  5. Customize Design: Modify themes and layouts to match your brand

Getting Help

  • Documentation: Explore our comprehensive guides
  • Community: Join Discord for support
  • GitHub: Report issues and contribute on GitHub
  • Professional Services: Contact us for custom development and consulting

Need Help?

If you encounter issues during installation, check our troubleshooting guide or ask the community on Discord.

On this page