Giter VIP home page Giter VIP logo

bb-price-tracker's Introduction

Cyclic-MERN-Starter-Kit

A demo repo with the deployment setup/basic architecture of a robust full-stack application. Good template for starting a MERN project!

Credits

Want to Contribute?

  • If you find any bugs, or have a small feature you'd like to see, please make an Issue.

Roadmap:

  • Implement Update functionality for the "Example" Object.
  • Add better documentation for how this app works.

Tech Used:

  • React
  • Tailwind CSS
  • Express
  • Mongoose
  • MongoDB

Tools, Accounts & Downloads

Local Initialization

Installation

  • Clone the repo
  • Run npm ci in the root folder to install the server dependencies.
  • Run cd client then run npm ci to install the client dependencies.

Set up environment variables

  • In the server/config folder, create a file titled ".env"
    • This file, which will contain sensitive info, will automatically be ignored by .gitignore
  • You can use the template in server/config/env.example to insert your environment variables

.env template setup

Please copy and paste the contents of the env.example file into a new file titled .env instead of modifying or removing the contents of env.example from the server/config folder

Keeping DB_STRING as mongodb://127.0.0.1:27017/ will generate an instanced MongoDB in your local. To view your database, you can use compass. You can also create a MongoDB database on MongoDB.com, but would need to update the DB_String to connect to MongoDB.

# Please copy and paste this template into a new .env file instead of removing .example from the file name
# Do not change PORT or OAUTH_REDIRECT_URL
# DB_STRING will create a MongoDB instance on your computer but can be changed to a mongodb.com cluster
PORT = 2121
DB_STRING = mongodb://127.0.0.1:27017/
NODE_ENV=development

Running the application

  • Run npm run dev to run the app in development mode. The client and server will then run concurrently.
    • Note: The npm start script is ONLY meant for production, i.e. our Cyclic deployment.

Deploying to Cyclic

Initial Setup:

  • Clone the repository
  • Set up on cyclic - deployment will succeed
  • Open the application at the given URL - it will have errors
  • This is the expected behavior, as we still need to connect our application to MongoDB

Connect to MongoDB:

  • If you have not already, create a MongoDB account
  • Create a MongoDB "Shared" database (which is free!), and name it whatever you like
  • Create a new cluster
  • In the cluster's settings, whitelist 0.0.0.0 in the Network Access section to whitelist all IP addresses
  • Get the connection string from the MongoDB "Connect" menu

Set Environment Variabes:

  • Paste the connection string in the Variables tab in Cyclic
  • Set/create the variable "PORT" to "2121" in the Variables tab in Cyclic
  • This will allow your application to connect to your MongoDB cluster
  • Set/create the variable "NODE_ENV" and set it to "production"

No need to re-deploy afterwards. The serverless nature of Cyclic will cause your app to load your variables in on the next refresh.

Enjoy your brand new fully deployed full-stack MERN application!

bb-price-tracker's People

Contributors

colinksmith 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.