Coder Social home page Coder Social logo

the-calculator-app's Introduction

Calculator

A simple calculator app that performs basic arithmetic operations like addition, subtraction, multiplication, and division. The project is a monorepo managed by Turborepo. There are two apps - backend and frontend. Backend is just a very simple Express.js server exposing API endpoint that handles the logic of calculations. Frontend is a UI layer that renders calculator component and calls backend to get the result of the operation.

Tech stack

  • Next.js, React (frontend)
  • Node.js, Express.js (backend)
  • Turborepo
  • TypeScript
  • Docker
  • Jest, React Testing Library, MSW, Supertest

Source

  • apps/backend - Express.js API
  • apps/frontend - Next.js app
  • packages/core - code to share between frontend and backend

Running locally

You need Node in version 18 (or higher) installed beforehand.

Install npm dependencies:

npm install

Run apps in dev mode:

npm run dev

You can now access services:

frontend http://localhost:3000
backend  http://localhost:3001

Running via Docker

Firstly create a network, which allows containers to communicate:

docker network calculator-network

Then, build docker images for backend and frontend:

npm run docker:build

Finally, run docker containers:

npm run docker:start

Ports used by dockerized services are the same as in "Running locally" section.

Tests

All packages and apps have tests using Jest as a test runner.
To run tests for all workspaces:

npm run test

To run tests for specific app/package (in this example: frontend):

npm run test -- --filter=@workspace/frontend

The value of the --filter argument comes from the package.json of targeted workspace.

the-calculator-app's People

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.