Files
hitstar/src/server-deno/QUICK_START.md

3.0 KiB

Quick Start Guide - Deno Backend

Get the new Deno backend running in 5 minutes!

Prerequisites

  1. Install Deno (if not already installed):

    # Windows (PowerShell)
    irm https://deno.land/install.ps1 | iex
    
    # macOS/Linux
    curl -fsSL https://deno.land/install.sh | sh
    
  2. Verify installation:

    deno --version
    

Setup

  1. Navigate to the new backend:

    cd src/server-deno
    
  2. Create environment file (optional):

    cp .env.example .env
    

    Default settings work out of the box!

  3. Run the server:

    deno task dev
    

That's it! The server will start on http://localhost:5173

What Just Happened?

Deno automatically:

  • Downloaded all dependencies
  • Compiled TypeScript
  • Started the HTTP server
  • Enabled hot reload

No npm install needed! 🎉

Testing the Server

Check Server Health

# Get playlists
curl http://localhost:5173/api/playlists

# Get tracks
curl http://localhost:5173/api/tracks?playlist=default

Access from Browser

Open http://localhost:5173 in your browser to use the web interface.

Available Commands

# Development (with auto-reload)
deno task dev

# Production
deno task start

# Run tests
deno task test

# Format code
deno task fmt

# Lint code
deno task lint

# Type check
deno task check

Project Structure

src/server-deno/
├── main.ts              # Start here!
├── domain/              # Business logic
├── application/         # Services
├── infrastructure/      # File system, streaming
├── presentation/        # HTTP & WebSocket
└── shared/              # Utilities

Configuration

Edit .env to customize:

PORT=5173                # Server port
HOST=0.0.0.0            # Server host
DATA_DIR=../../data     # Audio files location
PUBLIC_DIR=../../public # Static files location
LOG_LEVEL=INFO          # Logging level

Troubleshooting

Port Already in Use

# Change port in .env
PORT=3000

Audio Files Not Found

# Update data directory in .env
DATA_DIR=./data

Module Errors

# Clear cache and retry
deno cache --reload main.ts

Next Steps

  1. Read the full documentation: MIGRATION_GUIDE.md
  2. Explore the code: Start with main.ts
  3. Check the architecture: Review layer structure
  4. Run tests: deno task test

Getting Help

  • Check the README.md for architecture overview
  • See MIGRATION_GUIDE.md for detailed documentation
  • Review code comments for implementation details

Comparison with Old Backend

Feature Old (Node.js) New (Deno)
Setup time npm install (~2 min) Instant
Dependencies node_modules/ (100+ MB) Cached (~10 MB)
Type safety None Full TypeScript
Hot reload nodemon Built-in
Security Manual Permissions-based

Enjoy the new backend! 🚀