Code Monkey home page Code Monkey logo

react-express-demo's Introduction

React + Express Tech Demo

This is a simple tech demo using a React front-end and an Express + PostgreSQL back-end.

The application connects to the defined PostgreSQL server, creates the required database and table, and then uses it to store a watchlist of stock symbols.

The FE makes a websocket connection that the BE uses to pipe updated stock prices through.

For this project, prices are randomized and have a 50% chance of being updated every second.

Project Structure

The project is split into 2 parts.

/app - This is the front-end part of the application
/server - This is the back-end part of the application

Theoretically, they could be separated and deployed independantly of each other without issue. But for this project they are both run simultaneously on the same machine for ease.

Project Tech

I've used React and Express as they were the two main points of learning I wanted to tackle. For other things I've fallen back on tooling I'm comfortable with.

I opted to use Material UI for React as it was the quickest plug-and-play option I could find that had the pre-built components I wanted. Given more time, I would probably use something else.

How to setup & run locally

Clone the repo and yarn install.

You will need to set up a PostgreSQL server that the application can access.

Create a .env file in the /server folder and populate it with the following values:

POSTGRES_USER=apples # PostgreSQL user name to be used
POSTGRES_PASSWORD=oranges # PostgreSQL password to be used
POSTGRES_HOST=localhost # PostgreSQL hostname
POSTGRES_PORT=5432 # PostgreSQL port

# This is the URL of the FE client. Needed for CORs shenanigans
CLIENT_URL=http://localhost:5173

And finally, yarn dev to start it up. The URL that the FE is being served at will be displayed in the console output and defaults to http://localhost:5173

react-express-demo's People

Contributors

tmktahu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.