Skip to main content

DAF Backend API

Complete backend solution for e-commerce and Point of Sale systems with PostgreSQL database integration

Quick start

Get up and running with DAF Backend in minutes

1

Clone the repository

Clone the DAF Backend repository to your local machine:
git clone https://github.com/GoldenKra64/daf-backend.git
cd daf-backend
2

Install dependencies

Install the required Node.js packages:
npm install
3

Configure environment variables

Create a .env file in the root directory with your database credentials:
PORT=3000

# POS Database Configuration
POS_HOST=localhost
POS_PORT=5432
POS_NAME=pos_database

# E-commerce Database Configuration
ECOM_HOST=localhost
ECOM_PORT=5432
ECOM_NAME=ecom_database

# JWT Configuration
JWT_SECRET=your_secret_key_here

# Frontend Configuration
FRONTEND_IP=http://localhost:5173

# Pagination
PAGINATION_LIMIT=10
4

Start the development server

Run the server in development mode with auto-reload:
npm run dev
The API will be available at http://localhost:3000
5

Test your first API call

Authenticate to get your JWT token:
cURL
curl -X POST http://localhost:3000/api/pos/auth \
  -H "Content-Type: application/json" \
  -d '{"usuario": "your_db_username", "password": "your_db_password"}'
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "usuario": "your_db_username"
}

Explore by topic

Choose your integration path

POS System

Complete Point of Sale API with product management, inventory tracking, invoicing, and supplier management

E-Commerce Platform

Customer-facing e-commerce API with shopping cart, payment processing, and product browsing

Authentication

JWT-based authentication system with database credential management

Database Architecture

PostgreSQL database design with connection pooling and credential-based access

Key features

Everything you need for modern commerce systems

🏗️

Dual-System Architecture

Separate POS and E-commerce systems sharing a unified backend infrastructure

🔐

JWT Authentication

Secure authentication with database credentials embedded in JWT tokens

📦

Inventory Management

Complete kardex tracking for products and raw materials with movement history

🖼️

Image Upload Support

Built-in image handling with Multer and Sharp for product photos

💳

Payment Processing

E-commerce payment integration with shopping cart management

📄

Invoice Generation

Complete invoicing system with transaction tracking and PDF generation

Ready to get started?

Follow our quickstart guide to set up your development environment and make your first API call

Start Building