GithubHelp home page GithubHelp logo

softmakers-contatos's Introduction

SoftMakers-Contatos

Made by

Technologies πŸš€:

Technologies that I used to develop this MVC

Directories tree

β”œβ”€β”€ src
β”‚   β”œβ”€β”€ config
β”‚   β”œβ”€β”€ controllers
β”‚   β”œβ”€β”€ database
β”‚   β”‚   └── migrations
β”‚   β”œβ”€β”€ dtos
β”‚   β”œβ”€β”€ errors
β”‚   β”œβ”€β”€ middlewares
β”‚   β”œβ”€β”€ models
β”‚   β”œβ”€β”€ repositories
β”‚   β”œβ”€β”€ routes
β”‚   β”œβ”€β”€ server.ts
β”‚   β”œβ”€β”€ services
β”‚   β”œβ”€β”€ tools
β”‚   β”œβ”€β”€ @types
β”‚   β”œβ”€β”€ utils
β”‚   └── views
β”œβ”€β”€ uploads

Inside the project -

  • User: Represents a contact
  • Admin: Represents a user, who can create, update and delete contacts

Environment variables -

  • NODE_ENV: Defines the environment (Ex.: development / production)
  • PORT: Defines the port on which the application runs (Ex.: 3333)
  • APP_SECRET: Defines the secret of the application, which guarantees the uniqueness of the tokens (Ex.:asdybhq47qrdb)
  • APP_TTL: Defines the time of validity of a token (Ex.: 1d)
  • DB_TYPE: Defines the type of database (Ex.: postgres)
  • DB_HOST: Defines the host of database (Ex.: localhost)
  • DB_PORT: Defines the port of database (Ex.: 5432)
  • DB_USERNAME: Defines the username of database (Ex.: admin)
  • DB_PASSWORD: Defines the password of database (Ex.: admin123)
  • DB_NAME: Defines the name of database (Ex.: softmakers-contatos)

Getting started πŸ–₯️:

Requirements

Obs.: I recommend use docker

Clone the project and access the folder

$ git clone https://github.com/adoidadox2/SoftMakers-Contatos.git && cd SoftMakers-Contatos

Follow the steps below

# Install the dependencies
$ yarn

# Make a copy of '.env.example' to '.env'
# and set with YOUR environment variables.
$ cp .env.example .env

# Create the instance of postgreSQL using docker
$ docker run --name softmakers-contatos-postgres -e POSTGRES_USER=docker \
              -e POSTGRES_DB=softmakers-contatos -e POSTGRES_PASSWORD=docker \
              -p 5432:5432 -d -t postgres

# Once the services are running, run the migrations
$ yarn typeorm migration:run

To start the server in a development environment:

$ yarn dev:server

To start the server in a production environment (remember to put "production" at NODE_ENV):

#To transpile from Typescript to Javascript
$ yarn build

#To run the server already transpiled
$ yarn start

Comments -

  • All ID's are uuid
    • Handled errors return their HTTP status and a specific error message. ** Ex ** .: {"status": "error", "message":" User not found "}
  • Unexpected errors are treated as status 500 - Internal Server Error

Routes

Views -

#Create new admin
/admin

#Login
/session

#List all contacts, ( accepts pagination - 10 contacts per page Ex.: /user?page=1 )
/user

#Create new contact
/user/new

#Contact details
/user/:id

#Edit contact
/user/:id/edit

Challenges for me & Strategies to a scalable application πŸ“ˆ:

  • First time creating MVC, as well as my first time dealing with HTML, I can say that I learned a lot in less than a week
  • I've never used template engines before, I think it was a good experience, especially due to typescript, because I found some incredible packages (like ShellJs) needed to dynamically copy view's folder to the transpiled directory
  • I believe that for a more scalable application, a functionality for creating and authenticating users of the system must be implemented, as well as preventing large flows of requests / DDoS and add sentry to monitor the application in production
  • List users by address, using the address 1 - N user relation

License πŸ“:

This project is licensed under the MIT License - see the LICENSE file for details.


Author πŸ‘¨β€πŸ’»:

Made with ❀️ by Augusto VinΓ­cius πŸ‘‹πŸ» Get in touch!

softmakers-contatos's People

Contributors

adoidadox2 avatar

Watchers

James Cloos avatar  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.