| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Deploying web apps to production is hard. This GPLv3-licensed open source template contains sensible defaults for web apps implementing MongoDB, Express, React, & Node.js, otherwise known as the MERN stack.
This template improves upon a pure MERN stack by including nice-to-have technologies, such as Ant Design, GraphQL, TypeScript, LESS, and JSX in Markdown. I include example components demonstrating how the frontend & backend interact, following best practices in a serverless enviornment.
I use this template as a starting point for all my web apps. If this template helps you, please consider leaving me an endorsement on LinkedIn.
git clone https://github.com/timothymiller/mern-ant-design-graphql-next-template.git
cd mern-ant-design-graphql-next-template
yarn
yarn devNode API scaling is handled automatically when targeting serverless deployment to Now by ZEIT.
Resources inside of /static/ are deployed to the in-house CDN managed via Now by ZEIT.
now login
now -e MONGODB_URI="<replace_with_your_mongodb_uri>" --prodCreate an account on MongoDB Atlas and create a free tier managed database.
Copy the connection string for accessing the database.
Replace username & password with your database credentials.
Create a file called '.env' (no single quotes) in the root directory with the following text
MONGODB_URI=your_mongodb_uri_hereReplace your_mongodb_uri_here with the uri provided for the database you created from MongoDB Atlas.
Sensitive credentials must be stored with adequate security in a production enviornment. For this, I use Now Secrets. Add an environment variable called MONGODB_URI to your web app for accessing your MongoDB instance by executing the following command:
now secrets add MONGODB_URI your_mongodb_uri_hereNow handles loading enviornment variables into your runtime config behind the scenes. To allow Now to manage your secrets in development mode, use
now devinstead of
yarn devUnder apollo/datasources/MyAPI.js
this.baseURL = 'https://template.timknowsbest.com/api/';must be changed to
this.baseURL = 'http://localhost:3000/api/';to debug using your local API server for GraphQL queries.
This Template is licensed under the GNU General Public License, version 3 (GPLv3) and is distributed free of charge.
Timothy Miller
GitHub: https://github.com/timothymiller 💡
Website: https://timknowsbest.com 💻
Donation: https://timknowsbest.com/donate 💸
| Back | FazBrowse Home | New Git URL |