Skip to content

ImSeanConroy/cookbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cookbook: all your recipes in one place

Fullstack cookbook application built using PostgreSQL, Express, React, and Node.

Table of Contents

Getting Started

1. Prerequisites

Before getting started, ensure you have the following installed:

2. Installation

Follow these steps to set up the application locally:

  1. Clone the repository:
git clone https://github.com/imseanconroy/cookbook.git
cd cookbook

3. Frontend Setup:

  1. Install Dependencies: Navigate to the frontend directory and install required dependencies:
cd frontend
npm install
  1. Configure Environment Variables: Create a .env file in the frontend directory with the following content:
VITE_API_BASE_URL=http://localhost:8000
  1. Start Frontend Development Server: Run the following command to start the frontend development server:
npm run dev

4. Backend & Database Setup:

  1. Install Backend Dependencies: Navigate to the backend directory and install the required dependencies:
cd backend
npm install
  1. Configure Environment Variables: Create a .env file in the backend directory with the following content:
PORT=8000
NODE_ENV=development
READ_ONLY=false

SESSION_SECRET=example
SESSION_EXPIRES_IN=1d

FRONTEND_ORIGIN=http://localhost:5173

PGADMIN_DEFAULT_EMAIL=<pg_admin_email>
PGADMIN_DEFAULT_PASSWORD=<pg_admin_password>

POSTGRES_PASSWORD=<database_password>
POSTGRES_USER=<database_user>
POSTGRES_DB=<database_name>
POSTGRES_PORT=5432
POSTGRES_HOST=localhost

DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
  1. Start Docker Container: Run the following command to start the Docker container:
docker compose up -d
  1. Access PGAdmin: Open your browser and go to localhost:5050 to log in to PGAdmin using the credentials defined in the .env file. Once logged in, connect to PostgreSQL and connect to the database matching the name defined in {POSTGRES_DB}.

  2. Run Database Migrations: Use PG-migrate to set up the database tables by running:

DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} npm run migrate:up
  1. Start Backend Development Server: Run the following command to start the backend development server:
npm run dev

Development and Testing

Run all backend tests with the following command:

cd backend
npm run test

Project Structure

cookbook/
├── frontend/                  # React application for the user interface
├── backend/                   # Express.js server with PostgreSQL integration
│   ├── migrations/            # Database migration files
│   ├── test/                  # Backend tests
│   ├── src/                   # Backend source code
│   │   ├── config/            # Database and environment configurations
│   │   ├── controllers/       # API request handlers
│   │   ├── middleware/        # Request processing logic (e.g., auth, logging)
│   │   ├── repositories/      # Database queries and schema models
│   │   ├── routes/            # API endpoint definitions
│   │   ├── services/          # Core business logic
│   │   └── util/              # Utility functions (e.g., validation, logging)
└── README.md                  # Project documentation

Contributing

Contributions are welcome. Please open an issue or submit a pull request for any enhancements or bug fixes.

License

This project is Distributed under the MIT License - see the LICENSE file for information.

Support

If you are having problems, please let me know by raising a new issue.

About

All your recipes in one place

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages