InstaQuiz
Github
  • Introduction
  • Setup
    • Requirements
    • Environment setup
    • Testing
  • Database
    • Schema
    • Setup
  • Server
    • Folder structure
    • Code structure
    • API Reference
  • Client
    • Folder structure
    • Code structure
  • deployment
    • Your own server
    • Fly.io
Powered by GitBook
On this page
  • Cloning
  • Installing dependencies
  • Database
  • Bot
  1. Setup

Environment setup

PreviousRequirementsNextTesting

Last updated 1 year ago

Follow instructions below to setup your development environment.

Cloning

Clone the project from Github in your terminal:

git clone https://github.com/yasdpt/insta-quiz.git

cd insta-quiz

Installing dependencies

The project is in a monorepo structure and the code for the backend is in ./server folder and the code for the frontend is in ./client folder

To install server dependencies from the root folder run commands:

cd server

# install server dependencies
pnpm install

# Create environment variables and replace them with your own values
cp .env.example .env

After signing up at and creating your database you will receive a connection string, set them in your .env file from this format:

postgres://<PGUSER>:<PGPASSWORD>@<PGHOST>/<PGDATABASE>

To install client dependencies from the root folder run commands:

cd client

# install client dependencies
pnpm install

# Create environment variables
cp .env.example .env
# env for production run
cp .env.example .env.production

Database

After setting environment variables for your server now you can create and populate your database with it's tables, categories and questions. some sample categories with around 50 questions are located at ./server/db/categories in json format and ready scripts to create the database.

Go to server folder and run these commands:

# go to server folder from root folder
cd server

# database creation script
node db/create.js

# (optional) populate your database with questions, may take some time to run
node db/seed.js

Bot

Once you have the bot token put it in the server's .env file

You can download complete data from and put them in the categories folder

Create a Telegram bot if you haven't already and if not you can follow these instructions from the official Telegram website:

Neon
here
https://core.telegram.org/bots/tutorial