Skip to main content

Seeder

This document describes how to use the Geekle seeding tool to initialize the database and populate it with initial data, as well as clearing data that is no longer required.

Prerequisites

  • A pre-existing deployment of Geekle.
  • Nodeblocks NPM token with read permissions on @basaldev packages.
  • Node.js 18.x or later.
  • (Recommended) VSCode
  • A mongoDB connection string (see Local Development)

Running the Seeder

  1. Clone the repository

  2. Install the dependencies

nvm use
yarn
  1. Create a .env file in the root of the repository from the default .env.example file. Fill it with the required environment variables (usually the Stripe API key and the MongoDB connection string).

Run the seeder with the following command:

yarn seeder list users

If it prints a list of all demand users, then you have successfully set up the seeder.

Important Commands

  • yarn seeder insert skills - Inserts the skills into the database. This is required for the application to function, as demand users cannot be created without skills.
  • yarn seeder insert admin 1 <email address> - Creates an admin user with the specified email address.

Additional Commands

You can see the list of available commands and create new commands by opening the repository in VSCode:

code .vscode/geekle-seeder.code-workspace

Check the src/commands/index.ts file for the list of available commands and their implementation.

To create a new command, either update or create a new file in the src/commands/<data-type> directory. Commands are implemented using the back-end service packages, and so you can use any of the data services from the backend to help create and update the data in the database.

We recommend reading through the existing commands to understand how they work and create new commands as neccessary to match your development and testing needs.