Skip to content

ARandomDev99/dash

Repository files navigation

Dash

Setup

  1. Clone the repository.
git clone https://www.github.com/ARandomDev99/dash.git
cd dash
  1. Install dependencies.
npm install
  1. Create a .env file in the root directory and give appropriate values to the following:
  • PGUSER: PostgreSQL user
  • PGPASSWORD: Password for PGUSER
  • PORT: The port which the server should listen to (default: 3000)
  • JWT_SECRET: Secret key for JSON Web Token

Optionally, additional .env variables related to the database can be added. Refer to the documentation for node-postgres. Ensure that PGUSER has the necessary permissions to manage the database and its tables. 4. Start the PostgreSQL server. 4. Start the development server.

npm run dev

This command will build the SvelteKit app and start the Express server. The server will listen to the port specified in the .env file.

Approach

The project uses SvelteKit + Tailwind CSS for frontend and Express to provide API endpoints. SvelteKit uses adapter-node for integration with Express. index.js calls a function that initializes the PostgreSQL tables if they don't already exist:

CREATE SCHEMA IF NOT EXISTS dash;
CREATE TABLE IF NOT EXISTS dash.users (
    username TEXT PRIMARY KEY,
    password TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS dash.channels (
    id BIGSERIAL PRIMARY KEY,
    user1 TEXT NOT NULL REFERENCES dash.users(username),
    user2 TEXT NOT NULL REFERENCES dash.users(username)
);
CREATE TABLE IF NOT EXISTS dash.messages (
    id BIGSERIAL PRIMARY KEY,
    channel BIGINT NOT NULL REFERENCES dash.channels(id),
    author TEXT NOT NULL REFERENCES dash.users(username),
    content TEXT NOT NULL
);

The ER Diagram for the same is: ER Diagram

Home Page

Home Page

Sign In / Sign Up Pages

Sign In Page

Sign Up Page

Basic Layout (Incomplete)

Layout

Layout 2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published