Getting Started
Getting Started with Astro-Basics
Section titled “Getting Started with Astro-Basics”Welcome to astro-basics! This guide will help you get up and running with our component library and development framework.
What is Astro-Basics?
Section titled “What is Astro-Basics?”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
Prerequisites
Section titled “Prerequisites”Before you begin, make sure you have:
- Node.js 18 or higher
- npm or your preferred package manager
- Basic knowledge of Astro and React
Installation Methods
Section titled “Installation Methods”Option 1: Clone the Repository
Section titled “Option 1: Clone the Repository”For a complete setup with all features:
git clone https://github.com/shawn-sandy/astro-basics.gitcd astro-basicsnpm installOption 2: Use as Package (Component Library)
Section titled “Option 2: Use as Package (Component Library)”To use just the components in your existing project:
npm install astro-basics-websiteThen import components:
---import { Header } from 'astro-basics-website'---
<Header title="My Site" />Environment Setup
Section titled “Environment Setup”-
Copy environment template:
Terminal window cp .env.example .env -
Configure required variables:
# Required for authenticationPUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...CLERK_SECRET_KEY=sk_test_...# Optional: Database configurationSUPABASE_URL=https://...SUPABASE_ANON_KEY=eyJ...# Optional: Turso configurationTURSO_DATABASE_URL=libsql://...TURSO_AUTH_TOKEN=...
Development Commands
Section titled “Development Commands”Start the development server:
# Recommended: Start dev server with SCSS watchingnpm run start
# Or just the Astro dev servernpm run devBuild for production:
npm run buildRun tests:
# Unit testsnpm test
# E2E tests (requires: npx playwright install)npm run test:e2eSetup Options
Section titled “Setup Options”Choose your setup path based on your needs:
Quick Start (5 Minutes)
Section titled “Quick Start (5 Minutes)”For minimal setup to start exploring:
- Clone and install dependencies
- Configure Clerk authentication
- Start development server
👉 See Installation Guide for quick setup.
Complete Setup (Full Features)
Section titled “Complete Setup (Full Features)”For production-ready setup with all features:
- Authentication - Clerk integration with protected routes
- Database - Supabase (PostgreSQL) or Turso (LibSQL) with seamless switching
- Role Configuration - Customizable user roles with TypeScript type safety
- Security Features - CSRF protection, rate limiting, RLS policies
👉 See Complete Setup Guide for comprehensive configuration.
Next Steps
Section titled “Next Steps”After setup, explore these guides:
Core Setup Guides
Section titled “Core Setup Guides”- Complete Setup - Comprehensive configuration (auth, database, roles, security)
- Installation - Quick installation and basic setup
Role & Access Control
Section titled “Role & Access Control”- Configurable Roles - Custom role system with templates and examples
- Role Guard Usage - Access control patterns and best practices
Advanced Features
Section titled “Advanced Features”- Database Switching - Seamless backend provider switching
- Components - Component library reference
- API Reference - Detailed API documentation
Getting Help
Section titled “Getting Help”- GitHub Issues: Report bugs or request features
- Documentation: Browse this guide for detailed information
- Examples: Check the
/src/pages/directory for usage examples