Running the Deployment course project locally
Use this page to run the extracted Dream Catcher project on your computer. The version you have uses either the included SQLite database or a separate PostgreSQL database. Identify that version first, then follow its local setup.
What you need first
Install a supported LTS version of Node.js. Node 24 is recommended and includes npm. Prepare a key and model name for the provider imported by your project.
The PostgreSQL version also needs a reachable PostgreSQL database and its connection string, the postgresql:// URL that names its user, password, host, and database. A hosted service's free tier works if you do not run PostgreSQL locally. The SQLite version includes its database file and does not need a separate database service.
Identify the version you extracted
If the extracted project includes dreams.db, use the SQLite instructions. It does not need a separate database service. If its server expects DATABASE_URL, use the PostgreSQL instructions and prepare a reachable PostgreSQL database.
Open a terminal in the folder containing package.json:
$ cd path-to-your-downloaded-projectThe bundled README is stale
The README in the downloads describes a Claude and SQLite application even after the code has moved to OpenAI or Gemini and PostgreSQL. Use the downloaded package.json, imports, and server files as the authority.
The dependencies in package.json confirm the version: pg appears in the PostgreSQL version, a native SQLite driver appears in the earlier one, and the server file's import shows which database module is live.
dreams.db or a server that wants DATABASE_URL; that tells you whether to follow the SQLite or the PostgreSQL instructions. Ten seconds of checking now saves you from working through the wrong set of instructions later. Load a local .env file
The downloaded server reads process.env, but its start command does not load a local .env file. Open package.json and change:
"start": "node server.js"to:
"start": "node --env-file=.env server.js"This uses Node's built-in environment-file support without adding another dependency. Node stops with an error if the file named by --env-file is missing, and variables already set in your shell take precedence over the file's values. The Intro to AI Engineering project needs the same --env-file change for its backend.
Make sure .gitignore contains both lines:
.env
node_modules/One course snapshot contains the typo mode_modules; correct it to node_modules/ before committing your project. The Git handbook covers why these entries matter in ignoring files and good habits.
--env-file=.env to the start script so Node reads your settings file, and keep .env and node_modules/ out of Git. My first leaked key taught me that lesson faster than any course could. Run the SQLite version
The Push to GitHub snapshot imports the OpenAI implementation by default. Create .env beside package.json:
OPENAI_API_KEY=your-api-key-here
OPENAI_MODEL=your-model-id
PORT=3001DATABASE_PATH is optional. Without it, the server uses dreams.db in the project folder. If you set a custom path, make sure its directory exists and is writable.
Install the locked dependencies and start the server. npm ci installs exactly the versions in the lockfile, and the native SQLite package needs that, because it is compiled for your operating system and Node version:
$ npm ci
$ npm startOpen http://localhost:3001/, or the port you put in .env. Stop the server with Ctrl+C.
The project also contains a Gemini implementation, but the route imports the OpenAI file by default. If you follow the course's provider-switching code, use GEMINI_API_KEY and optional GEMINI_MODEL instead.
.env, run npm ci and npm start, then open port 3001 in your browser. The database file already comes with the project, so there is nothing extra for you to set up here. Run the PostgreSQL version
The later project replaces SQLite with PostgreSQL. Create a database first, then add its connection string to .env along with the AI configuration:
DATABASE_URL=postgresql://user:password@host:5432/database
OPENAI_API_KEY=your-api-key-here
OPENAI_MODEL=your-model-id
PORT=3001Then run:
$ npm ci
$ npm startThe final project initializes its tables before listening. If the database is unreachable or rejects its TLS settings, startup stops with a database error. The error text points at the cause: ENOTFOUND means the hostname did not resolve, password authentication failed means the credentials, and an SSL or TLS message means the encryption settings. The course code asks for an SSL connection, so a local PostgreSQL without TLS needs that requirement adjusted in the connection string. The /health endpoint checks the connection after startup:
http://localhost:3001/healthRemove the temporary shutdown route
The Terminating Processes & Signals lesson includes a /shutdown endpoint only for testing graceful termination. Follow the lesson instruction to delete that route before sharing or deploying the application. Leaving a public URL that terminates your server is unsafe.
.env, start the app, then visit /health to confirm the connection. Remove the temporary shutdown route before you share the app with anyone; I have forgotten that step myself, and it is not one you want to leave in a shared app. Troubleshooting
OPENAI_API_KEY environment variable is missing or empty: Confirm that the start script contains --env-file=.env, that .env is beside package.json, and that the variable name matches the imported provider file.
The page opens but creating a dream returns an AI error: Check the provider key and model together. No live AI request is needed to verify that the page and existing-dream API work.
SQLite reports a native-module error: Reinstall from a clean extraction with the supported Node LTS release, using npm ci. Do not copy node_modules from another operating system.
PostgreSQL startup fails: Check the full DATABASE_URL, database network access, credentials, and TLS requirements. The final course code asks for an SSL connection.
The database is empty after switching versions: SQLite data in dreams.db does not automatically appear in PostgreSQL. Run the course's migration steps or seed the new database separately.

