Prerequisites
Before you begin, ensure you have the following installed:- Node.js (v14 or higher)
- PostgreSQL (v12 or higher)
- npm or yarn package manager
Installation
Install dependencies
Install all required Node.js packages:The project uses the following key dependencies:
- Express - Web framework
- Knex - SQL query builder
- PostgreSQL (pg) - Database driver
- Auth0 - Authentication (express-jwt, jwks-rsa)
- Multer - File upload handling
- TypeScript - Type safety
Configure environment variables
Create a
.env file in the root directory with your configuration:See the Environment Variables page for detailed configuration options.
Run database migrations
Set up the database schema by running migrations:This will create all necessary tables (images, tags, items, items_to_tags).
Learn more about database migrations in the Migrations guide.
Available Scripts
The following npm scripts are available inpackage.json:
npm run dev- Starts the development server with hot-reloading usingts-node-devnpm run build- Compiles TypeScript to JavaScript in thedistdirectorynpm start- Runs the compiled production build fromdist/index.js
Project Structure
After setup, your project structure will look like this:Verify Installation
Test that everything is working:-
Check the root endpoint:
Expected response:
-
Verify database connection:
Check that all tables were created:
You should see:
images,tags,items, anditems_to_tagstables.
Next Steps
- Configure Environment Variables
- Learn about Database Migrations
- Review the API Reference for available endpoints