Fullstack cookbook application built using PostgreSQL, Express, React, and Node.
Before getting started, ensure you have the following installed:
Follow these steps to set up the application locally:
- Clone the repository:
git clone https://github.com/imseanconroy/cookbook.git
cd cookbook
- Install Dependencies: Navigate to the
frontend
directory and install required dependencies:
cd frontend
npm install
- Configure Environment Variables: Create a
.env
file in the frontend directory with the following content:
VITE_API_BASE_URL=http://localhost:8000
- Start Frontend Development Server: Run the following command to start the frontend development server:
npm run dev
- Install Backend Dependencies: Navigate to the
backend
directory and install the required dependencies:
cd backend
npm install
- Configure Environment Variables: Create a
.env
file in thebackend
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}
- Start Docker Container: Run the following command to start the Docker container:
docker compose up -d
-
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}
. -
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
- Start Backend Development Server: Run the following command to start the backend development server:
npm run dev
Run all backend tests with the following command:
cd backend
npm run test
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
Contributions are welcome. Please open an issue or submit a pull request for any enhancements or bug fixes.
This project is Distributed under the MIT License - see the LICENSE file for information.
If you are having problems, please let me know by raising a new issue.