Saltearse al contenido

Setup

Esta página aún no está disponible en tu idioma.

This guide will walk you through setting up LaunchFast. We will go through the process of cloning the project, installing dependencies, setting up your database and running the local development server.

Prerequisites

Before you can get started, you will need to have the following installed on your machine.

  • Node.js (v18 or higher)
  • Git
  • VSCode (recommended, or any other code editor)
  • Project setup

    1. Create a new database

      You can use any database including PostgreSQL, SQLite, Redis, MongoDB, and Firestore.

      Before creating a new LaunchFast project, make sure to have created a new database and have the environment variables ready. For example when using PostgreSQL, the connection string will look something like this:

      Terminal window
      postgresql://user:password@host:port/database
    2. Initialize a new LaunchFast project

      First you need to clone the LaunchFast repository:

      Terminal window
      git clone https://github.com/LaunchFast-Boilerplates/launchfa.st-astro

      Next, we are going to install all the dependencies. Make sure you have installed npm before running the following command:

      Terminal window
      npm install

      Now, we need to set up the environment variables. To do this, copy the .env.example file in the root of your project and rename it to .env.

      Then open the .env file and set at least the DATABASE_TYPE and the relevant database provider environment variables:

      Terminal window
      # Database
      ## "pg" OR "redis" OR "mongodb" OR "sqlite" OR "firestore"
      DATABASE_TYPE="pg"
      ## Redis (/Upstash) Environment Variable
      REDIS_URL="redis://default:...@...upstash.io:..."
      ## Postgres (/Neon) Environment Variable
      POSTGRES_URL="postgresql://neondb_owner:...@...-pooler.us-east-2.aws.neon.tech/neondb?sslmode=require"
      ## MongoDB Environment Variable
      MONGODB_URL="mongodb+srv://<username>:<password>@<prefix>.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
      ## SQLite Environment Variable
      SQLITE_URL="libsql://....turso.io"
      SQLITE_AUTH_TOKEN="..."
      ## Firebase
      FIREBASE_PROJECT_ID="..."
      FIREBASE_PRIVATE_KEY_ID="..."
      FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
      FIREBASE_CLIENT_EMAIL="firebase-adminsdk-..@...iam.gserviceaccount.com"
      FIREBASE_CLIENT_ID="..."
      FIREBASE_STORAGE_BUCKET="gs://...appspot.com"

      Further, to initiate the relevant schema on the database provider, run the following:

      Terminal window
      npm run db:setup

      The last step is to set the LaunchFast repository as the upstream origin for your project, so you can pull in updates in the future.

      Run the following commands:

      Terminal window
      rm -rf .git
      git init
      git remote set upstream https://github.com/LaunchFast-Boilerplates/launchfa.st-astro
      git add -A
      git commit -m "Initial commit"
      git push
    3. Set up your storage provider

      Storage is necessary to upload and serve files like images for example for the avatars of users. LaunchFast supports all S3-compatible storage providers (AWS S3, Cloudflare R2, and Supabase Storage) and Firebase Storage.

    4. Start your development server

      Now your app should be ready to go. To start the local development server, navigate into your project root folder and run the following command.

      Terminal window
      npm run dev

      Open localhost:3000 in your browser to see the your app.