Skip to content

Getting Started

Welcome to astro-basics! This guide will help you get up and running with our component library and development framework.

Astro-basics is a production-ready web development framework built on Astro that provides:

  • Component Library: Reusable Astro and React components
  • Authentication: Pre-configured Clerk integration with protected routes
  • Database Support: Supabase (PostgreSQL) and Turso (LibSQL) with seamless switching
  • Role System: Configurable user roles with TypeScript type safety
  • Security Features: CSRF protection, rate limiting, RLS policies
  • Styling System: SCSS-based design tokens and utilities
  • Testing Suite: Unit and E2E testing with Vitest and Playwright
  • PWA Ready: Progressive Web App capabilities with offline support

Before you begin, make sure you have:

  • Node.js 18 or higher
  • npm or your preferred package manager
  • Basic knowledge of Astro and React

For a complete setup with all features:

Terminal window
git clone https://github.com/shawn-sandy/astro-basics.git
cd astro-basics
npm install

Option 2: Use as Package (Component Library)

Section titled “Option 2: Use as Package (Component Library)”

To use just the components in your existing project:

Terminal window
npm install astro-basics-website

Then import components:

---
import { Header } from 'astro-basics-website'
---
<Header title="My Site" />
  1. Copy environment template:

    Terminal window
    cp .env.example .env
  2. Configure required variables:

    # Required for authentication
    PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
    CLERK_SECRET_KEY=sk_test_...
    # Optional: Database configuration
    SUPABASE_URL=https://...
    SUPABASE_ANON_KEY=eyJ...
    # Optional: Turso configuration
    TURSO_DATABASE_URL=libsql://...
    TURSO_AUTH_TOKEN=...

Start the development server:

Terminal window
# Recommended: Start dev server with SCSS watching
npm run start
# Or just the Astro dev server
npm run dev

Build for production:

Terminal window
npm run build

Run tests:

Terminal window
# Unit tests
npm test
# E2E tests (requires: npx playwright install)
npm run test:e2e

Choose your setup path based on your needs:

For minimal setup to start exploring:

  1. Clone and install dependencies
  2. Configure Clerk authentication
  3. Start development server

👉 See Installation Guide for quick setup.

For production-ready setup with all features:

  1. Authentication - Clerk integration with protected routes
  2. Database - Supabase (PostgreSQL) or Turso (LibSQL) with seamless switching
  3. Role Configuration - Customizable user roles with TypeScript type safety
  4. Security Features - CSRF protection, rate limiting, RLS policies

👉 See Complete Setup Guide for comprehensive configuration.

After setup, explore these guides:

  1. Complete Setup - Comprehensive configuration (auth, database, roles, security)
  2. Installation - Quick installation and basic setup
  1. Configurable Roles - Custom role system with templates and examples
  2. Role Guard Usage - Access control patterns and best practices
  1. Database Switching - Seamless backend provider switching
  2. Components - Component library reference
  3. API Reference - Detailed API documentation
  • GitHub Issues: Report bugs or request features
  • Documentation: Browse this guide for detailed information
  • Examples: Check the /src/pages/ directory for usage examples