Logo Lanfrica

Kimilujoseph/SHAMBA_RECORDS

Domain:

agriculture

Record type:

software
Creator:
Kim
Host:
A SIMPLE APPLICATION FOR FARM RECORDS # Shamba Records Backend This repository contains the backend for the Shamba Records application, built with Node.js, Express, TypeScript, and Prisma. It follows a clean architecture pattern to ensure separation of concerns, maintainability, and scalability. ## Table of Contents - Project Overview - Prerequisites - Getting Started - Installation - Database Setup - Using a Database Dump File - Creating a New Database with Prisma - Environment Variables - Generating a New Hash Token - Running the Application - Project Structure - Prisma Commands ## Project Overview The Shamba Records Backend provides a robust API for managing agricultural records, users, and related data. It leverages a modern tech stack to deliver a performant and secure service. ## Prerequisites Before you begin, ensure you have the following installed: - **Node.js** (v18 or higher recommended) - **npm** (comes with Node.js) - **mysql** (or your chosen database system) - **Git** ## Getting Started ### Installation 1. **Clone the repository:** ```bash git clone github.com cd shamba_records_backend ``` 2. **Install dependencies:** ```bash npm install ``` ### Database Setup You have two options for setting up your database: using an existing dump file or creating a new one from scratch with Prisma. #### Using a Database Dump File If you have a MySQL database dump file (e.g., `shamba_records_dump.sql`), you can restore it using the `mysql` command-line tool. 1. **Create a new MySQL database and user:** ```bash # Connect to MySQL as root or a user with privileges to create databases/users mysql -u root -p # Enter your MySQL root password when prompted CREATE DATABASE shamba_records; CREATE USER 'shamba_user'@'localhost' IDENTIFIED BY 'your_secure_password'; GRANT ALL PRIVILEGES ON shamba_records.* TO 'shamba_user'@'localhost'; FLUSH PRIVILEGES; EXIT; ``` Replace `shamba_user` and `your_secure_password` with your desired credentials. 2. **R …