Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SEEDS API - Project Setup Guide

Prerequisites

Before you begin, ensure you have the following software installed on your machine:

  • Node.js (v14 or higher)
  • pnpm (v6 or higher)
  • Docker (if using Docker)
  • Git (for cloning the repository)

Cloning the Repository

First, clone the repository to your local machine:

using ssh (preferred)

git clone git@github.com:inix-x/seeds-api.git
cd seeds-api

using https

git clone https://github.com/inix-x/seeds-api.git
cd seeds-api

Installing Dependencies

This project uses pnpm for package management. Install all necessary dependencies by running:

pnpm install

Environment Variables

Create a .env file in the root directory of your project and add the necessary environment variables. You can use the .env.example file as a template:

cp .env.example .env

Edit the .env file to include your specific configuration. Here is an example:

PORT=3000
DB_HOST=localhost
DB_USER=root
DB_PASS=example

TypeScript Configuration

Ensure your tsconfig.json is properly set up. The following configuration is a good starting point:

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "commonjs",
    "outDir": "./build",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "baseUrl": ".",
    "paths": {
      "*": ["node_modules/*", "src/types/*"]
    }
  },
  "include": ["src"],
  "exclude": ["node_modules"]
}

Development

To start the development server with hot-reloading, run:

pnpm dev

This will start the server using ts-node-dev and automatically reload on file changes.

Building the Project

To compile the TypeScript code into JavaScript, run:

pnpm build

This will create a build directory containing the compiled JavaScript files.

Running the Built Project

To start the built project, run:

pnpm start

Running the Database:

alt text

Importing Data

  1. Login to docker, see above picture;
docker login -u YOUR_DOCKERHUB_USERNAME -p YOUR_PERSONAL_ACCESS_TOKEN
  1. Pull docker image
docker pull omrgrrdo/seeds_postgres:state_v1_2
  1. Importing data and run docker, using cli/terminal or running from docker desktop
docker run -d -p 5432:5432 --name seeds_container -v postgres-data:/var/lib/postgresql/data omrgrrdo/postgres:state_v1_2
docker cp ./db_backup.dump seeds_container:/tmp/mybackup.dump
docker exec -it seeds_container bash
pg_restore -U postgres -d mydatabase -v /tmp/mybackup.dump

Exporting Database

docker exec -t seeds_container pg_dump -U postgres seeds_database -F c -b -v -f tmp/mybackup.dump
docker cp seeds_container:/tmp/mybackup.dump ./db_backup.dump

Accessing Database, and adding new relations (optional)

If you want to modify the database

psql -U user -d seeds_database -h localhost

About

Backend of the inventory-pos system

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages