Code Monkey home page Code Monkey logo

atariq11700 / puttputtgolf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 3450-group-3/puttputtgolf

0.0 0.0 0.0 21.86 MB

This is the project repository for USU CS3450 Fall 2021 Group 3. This web app, called Putt N' Ale, is a web app for hosting tournaments for miniature golf or other hole-by-hole based games with integrated drink ordering.

License: GNU General Public License v3.0

Shell 0.05% Python 40.91% TypeScript 58.22% HTML 0.46% Mako 0.27% Batchfile 0.10%

puttputtgolf's Introduction

Group 3 README

Standup Notes

./doc/planning/standup/

Project Organization

  • /app contains the FastAPI backend API code
  • /client contains the React frontend code
  • /migrations contains database migrations generated with alembic
  • /tests contains the backend Python tests
  • The loose files at the root of the project are configuration / setup files

Tool Stack

  • Backend
    • Python - Language
    • FastAPI - Web framework
    • SQLite - Database Engine
    • SQLAlchemy - Database ORM
    • alembic - Database Migration tool
  • Frontend
    • TypeScript - Language
    • React - UI library
    • Webpack - Bundler
    • Babel - Transpiler

Style Guide

This project follows the style guides of the technologies being used and enforced by a linter and formatter.

Python

  • snake_case for variable and function names, PascalCase for class names
  • 4 spaced identation (spaces only to avoid mixed indentation errors)

Javascript

  • camelCase for variable names, PascalCase for class names
  • 2 space identations
  • PascalCase for component names and their related files (i.e the Home component would exist in Home.tsx)
  • Specific styles configurations can be seen in .prettierrc

Development

This project uses yarn and poetry for dependancy management. You'll need to install them to continue. Please make sure you have nodeJS installed and then use npm install -g yarn to install yarn. To install poetry on windows use the python package manager pip and run pip install --user poetry. If on linux run the command curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

Pull down this repository.

Install dependencies:

# For JS
$ yarn install

# For Python
$ poetry install

Configuration

The application is configured with a .env file. An example one is provided, but some fields may need to be populated.

  1. Copy .env.example to .env

  2. Generate a secret key with the below command and assign SECRET_KEY to it in .env

    $ openssl rand -hex 32
    

    Note: This being a cryptographically secure key is only really relevant for production, in development / testing, it can be left alone

Initialize Database

If you're upgrading past the db-rebase tag. You'll want to rm app.db before attempting to upgrade. (Could be a good idea regardless)

$ poetry run alembic upgrade head

Note that poetry run is used to run any command inside the virtual environment.

Start Development Servers

The frontend server can be started with

$ yarn dev

Note that this server is just used for compiling and serving JS assets, and shouldn't be accessed directly!

The API server can be started with NOTE:

the exec command is provided by a poetry plugin, which are only available when you are in a subshell. Before executing any exec commands you need to make sure that you're in a subshell with poetry shell

NOTE:

the exec command provided by the plugin only works in unix shells, if you are on windows, make sure you run poetry shell then proceed to run uvicorn app.main:app --reload --port 3000. You can also just run the single command poetry run uvicorn app.main:app --reload --port 3000. A third option is to make sure you are in the root folder of the project and then using command prompt, then run the batch script startserver.bat within the command prompt.

$ poetry exec start

Now you should be able to go to localhost:3000 in your browser and see the application running.

Building the Project

  1. To prepare the project for deployment we need to bunlde the JS assets.
    $ yarn build
    
  2. In production ENVIRONMENT in the .env needs to be set to production otherwise, it won't serve the bundled JS assets

NOTE The bundle js files have been pushed to master if you dont want to build them yourself. In that case still set ENVIRONMENT in the .env to production

Testing

  1. Linux
    poetry exec test
    
  2. Windows
    runtests.bat
    

Development Notes

  • FastAPI implements the OpenAPI spec, and as such can provide automatic API documentation. If the server is running, the docs should be accessible at localhost:3000/api/docs

Migrations

To create a migration, edit / create your new models. NOTE: make sure you are in a poetry venv using either poetry shell or poetry run

Run this command to generate the migration file

$ alembic revision -m "<message>" --autogenerate

To upgrade your DB

$ alembic upgrade head

Note alembic doesn't detect these changes: https://alembic.sqlalchemy.org/en/latest/autogenerate.html#what-does-autogenerate-detect-and-what-does-it-not-detect

Version Control Procedures

  • Make a new branch
  • Implement your features
  • Create a pull request
  • Have someone review the pr
  • Merge and delete the branch

puttputtgolf's People

Contributors

atariq11700 avatar seanrcollings avatar derethil avatar jonathan-gates 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.