A full-stack todo application built with PostgreSQL, Express, React, and Node.js.
-
Create a PostgreSQL database using a service like Supabase, Neon, or any other PostgreSQL provider.
-
Update the
.envfile in theserverdirectory:DATABASE_URL=your_production_database_url
-
Deploy the server to Vercel:
cd server npm install -g vercel vercel login vercel -
When prompted during deployment, set the following environment variables:
DATABASE_URL: Your PostgreSQL connection string
-
After deployment, Vercel will provide a URL for your backend API (e.g.,
https://your-app-name.vercel.app).
-
Update the
.env.productionfile in theclientdirectory:VITE_API_URL=https://your-backend-url.vercel.app
-
Deploy the client to Vercel:
cd client vercel -
Your frontend application will now be deployed and connected to your backend API.
-
Navigate to the server directory:
cd server -
Install dependencies:
npm install
-
Create a
.envfile with your local database configuration. -
Start the server:
npm run server
-
Navigate to the client directory:
cd client -
Install dependencies:
npm install
-
Start the development server:
npm run dev
CREATE TABLE users (
user_id SERIAL PRIMARY KEY,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE todo (
todo_id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(user_id),
description VARCHAR(255) NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);