Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ EXAMPLES ] Added with-mongodb example #13028

Merged
merged 46 commits into from May 30, 2020

Conversation

MichelleLucero
Copy link
Contributor

@MichelleLucero MichelleLucero commented May 18, 2020

Example Request

My team and I created a Next.js + MongoDB example that we would like to contribute to the Next.js project. It was mentioned here.

Collaborators:

Co-authored-by: Shania Dhani <31454777+sdhani@users.noreply.github.com>
Co-authored-by: Michelle Lucero <31500626+MichelleLucero@users.noreply.github.com>
Co-authored-by: Chi Shing Lee <60354073+chislee0708@users.noreply.github.com>
@Timer Timer added the examples Issue/PR related to examples label May 18, 2020
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Install [Vercel CLI](https://vercel.com/download), log in to your account from the CLI, and run the following commands to add the environment variables. Replace each variable in `<>` with your the corresponding `MONGO_URI` and `ROOT_URL`

```bash
now secrets add mongo_uri <MONGO_DBURI>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be handled by the environment UI https://vercel.com/blog/environment-variables-ui


### Step 4. Set up environment variables

Set `ROOT_URL` in [next.config.js](./next.config.js) to `http://localhost:3000` for quick testing locally, or set up your own development environment variables and use `process.env.ROOT_URL`. See the next.js [environement variable](https://nextjs.org/docs/api-reference/next.config.js/environment-variables) docs for more info.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be handled by using dotenv support: https://nextjs.org/blog/next-9-4#new-environment-variables-support

@ijjk
Copy link
Member

ijjk commented May 22, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
buildDuration 11.6s 11.5s -137ms
nodeModulesSize 61.8 MB 61.8 MB
Page Load Tests Overall increase ✓
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
/ failed reqs 0 0
/ total time (seconds) 1.975 1.997 ⚠️ +0.02
/ avg req/sec 1265.95 1251.77 -14.18
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.195 1.143 -0.05
/error-in-render avg req/sec 2091.5 2187.68 ⚠️ +96.18
Client Bundles (main, webpack, commons)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..fef6.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 56.9 kB 56.9 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.module.js gzip 5.58 kB 5.58 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.92 kB 6.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.4 kB 52.4 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.06 kB 2.06 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.22 kB 8.22 kB
Client Pages Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.52 kB 1.52 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Rendered Page Sizes
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
index.html gzip 928 B 928 B
link.html gzip 937 B 937 B
withRouter.html gzip 924 B 924 B
Overall change 2.79 kB 2.79 kB

Serverless Mode
General
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
buildDuration 12.6s 12.7s ⚠️ +139ms
nodeModulesSize 61.8 MB 61.8 MB
Client Bundles (main, webpack, commons)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..fef6.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 56.9 kB 56.9 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.module.js gzip 5.58 kB 5.58 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.92 kB 6.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.4 kB 52.4 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.06 kB 2.06 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.22 kB 8.22 kB
Client Pages Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.52 kB 1.52 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Serverless bundles
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_error.js 844 kB 844 kB
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 844 kB 844 kB
link.js 882 kB 882 kB
routerDirect.js 874 kB 874 kB
withRouter.js 874 kB 874 kB
Overall change 4.33 MB 4.33 MB

@sdhani
Copy link
Contributor

sdhani commented May 22, 2020

Thanks for the advice @timneutkens! Let me know if these are the changes you had in mind. 🙂

@ijjk
Copy link
Member

ijjk commented May 22, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
buildDuration 12s 11.7s -245ms
nodeModulesSize 61.8 MB 61.8 MB
Page Load Tests Overall increase ✓
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
/ failed reqs 0 0
/ total time (seconds) 2.02 2.008 -0.01
/ avg req/sec 1237.57 1244.88 ⚠️ +7.31
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.24 1.092 -0.15
/error-in-render avg req/sec 2015.32 2290.28 ⚠️ +274.96
Client Bundles (main, webpack, commons)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..fef6.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 56.9 kB 56.9 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.module.js gzip 5.58 kB 5.58 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.92 kB 6.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.4 kB 52.4 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.06 kB 2.06 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.22 kB 8.22 kB
Client Pages Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.52 kB 1.52 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Rendered Page Sizes
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
index.html gzip 928 B 928 B
link.html gzip 937 B 937 B
withRouter.html gzip 924 B 924 B
Overall change 2.79 kB 2.79 kB

Serverless Mode
General
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
buildDuration 12.6s 12.6s ⚠️ +44ms
nodeModulesSize 61.8 MB 61.8 MB
Client Bundles (main, webpack, commons)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..fef6.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 56.9 kB 56.9 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.module.js gzip 5.58 kB 5.58 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.92 kB 6.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.4 kB 52.4 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.06 kB 2.06 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.22 kB 8.22 kB
Client Pages Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.52 kB 1.52 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Serverless bundles
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_error.js 844 kB 844 kB
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 844 kB 844 kB
link.js 882 kB 882 kB
routerDirect.js 874 kB 874 kB
withRouter.js 874 kB 874 kB
Overall change 4.33 MB 4.33 MB

@lfades
Copy link
Member

lfades commented May 22, 2020

@MichelleLucero Hi there thank you for the PR, let's do the following updates to the example:

  • Use Static Generation instead of getInitialProps, and don't mention getInitialProps anywhere as SSR is not required for this example
  • Move all the instructions to the main readme (/data_import.md - /link-step.md) all of that, if it's too complicated then consider linking to a more comprehensive guide that focuses on that or write an executable script. Currently it's very vague and separated from the main readme
  • Next.js polyfills fetch for both browser and server so you can remove all the imports for 'isomorphic-unfetch'
  • Try to use document as less as possible and use React instead, there are some useEffect without an array of dependencies that don't seem very trusty to me (with some event handlers that are very prone to memory leaks)
  • The api routes have error handling, let's make sure the forms also do that with something more than just a console log
  • Remove comments with code (like the ones in pages/_app.js)

That should do it 👍

Copy link
Member

@lfades lfades left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requested some changes in the comment above

@ijjk
Copy link
Member

ijjk commented May 22, 2020

Stats from current PR

Default Server Mode (Decrease detected ✓)
General
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
buildDuration 12.9s 12.6s -368ms
nodeModulesSize 61.8 MB 61.8 MB
Page Load Tests Overall decrease ⚠️
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
/ failed reqs 0 0
/ total time (seconds) 2.331 2.404 ⚠️ +0.07
/ avg req/sec 1072.4 1039.99 -32.41
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.441 1.666 ⚠️ +0.22
/error-in-render avg req/sec 1734.92 1500.36 -234.56
Client Bundles (main, webpack, commons)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..fef6.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 56.9 kB 56.9 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.module.js gzip 5.58 kB 5.58 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.92 kB 6.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.4 kB 52.4 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.06 kB 2.06 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.22 kB 8.22 kB
Client Pages Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.52 kB 1.52 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Rendered Page Sizes
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
index.html gzip 928 B 928 B
link.html gzip 937 B 937 B
withRouter.html gzip 924 B 924 B
Overall change 2.79 kB 2.79 kB

Serverless Mode
General
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
buildDuration 13.2s 13.8s ⚠️ +533ms
nodeModulesSize 61.8 MB 61.8 MB
Client Bundles (main, webpack, commons)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..fef6.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 56.9 kB 56.9 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.module.js gzip 5.58 kB 5.58 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.92 kB 6.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.4 kB 52.4 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.06 kB 2.06 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.22 kB 8.22 kB
Client Pages Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.52 kB 1.52 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Serverless bundles
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_error.js 844 kB 844 kB
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 844 kB 844 kB
link.js 882 kB 882 kB
routerDirect.js 874 kB 874 kB
withRouter.js 874 kB 874 kB
Overall change 4.33 MB 4.33 MB

@@ -1,8 +1,8 @@
require('dotenv').config() /* For local environment var configuration */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This next.config.js is no longer needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sdhani
Copy link
Contributor

sdhani commented May 23, 2020

Awesome, we will get started on these changes and keep you all updated!

removed extra instructions on readme, linked it to the MongoDB guides
@ijjk
Copy link
Member

ijjk commented May 23, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
buildDuration 11.3s 11.4s ⚠️ +125ms
nodeModulesSize 61.8 MB 61.8 MB
Page Load Tests Overall increase ✓
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
/ failed reqs 0 0
/ total time (seconds) 1.901 1.944 ⚠️ +0.04
/ avg req/sec 1315.14 1285.83 -29.31
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.121 1.055 -0.07
/error-in-render avg req/sec 2229.45 2368.84 ⚠️ +139.39
Client Bundles (main, webpack, commons)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..fef6.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 56.9 kB 56.9 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.module.js gzip 5.58 kB 5.58 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.92 kB 6.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.4 kB 52.4 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.06 kB 2.06 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.22 kB 8.22 kB
Client Pages Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.52 kB 1.52 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Rendered Page Sizes
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
index.html gzip 928 B 928 B
link.html gzip 937 B 937 B
withRouter.html gzip 924 B 924 B
Overall change 2.79 kB 2.79 kB

Serverless Mode
General
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
buildDuration 12.1s 12s -91ms
nodeModulesSize 61.8 MB 61.8 MB
Client Bundles (main, webpack, commons)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.js gzip 6.49 kB 6.49 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..fef6.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 56.9 kB 56.9 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.module.js gzip 5.58 kB 5.58 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.92 kB 6.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.4 kB 52.4 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.06 kB 2.06 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.22 kB 8.22 kB
Client Pages Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.52 kB 1.52 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Serverless bundles
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_error.js 844 kB 844 kB
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 844 kB 844 kB
link.js 882 kB 882 kB
routerDirect.js 874 kB 874 kB
withRouter.js 874 kB 874 kB
Overall change 4.33 MB 4.33 MB

Co-authored-by: Luis Alvarez D. <luis@vercel.com>
@ijjk
Copy link
Member

ijjk commented May 25, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
buildDuration 11.3s 11.4s ⚠️ +154ms
nodeModulesSize 61.8 MB 61.8 MB
Page Load Tests Overall increase ✓
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
/ failed reqs 0 0
/ total time (seconds) 1.905 1.995 ⚠️ +0.09
/ avg req/sec 1312.41 1253.28 -59.13
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.152 1.116 -0.04
/error-in-render avg req/sec 2170.53 2240.87 ⚠️ +70.34
Client Bundles (main, webpack, commons)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.js gzip 6.59 kB 6.59 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..1e23.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.module.js gzip 5.67 kB 5.67 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.92 kB 6.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.06 kB 2.06 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.22 kB 8.22 kB
Client Pages Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.52 kB 1.52 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Rendered Page Sizes
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
index.html gzip 927 B 927 B
link.html gzip 937 B 937 B
withRouter.html gzip 924 B 924 B
Overall change 2.79 kB 2.79 kB

Serverless Mode
General
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
buildDuration 11.9s 12s ⚠️ +125ms
nodeModulesSize 61.8 MB 61.8 MB
Client Bundles (main, webpack, commons)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.js gzip 6.59 kB 6.59 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..1e23.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.module.js gzip 5.67 kB 5.67 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.92 kB 6.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.06 kB 2.06 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.22 kB 8.22 kB
Client Pages Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.52 kB 1.52 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Serverless bundles
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_error.js 844 kB 844 kB
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 844 kB 844 kB
link.js 882 kB 882 kB
routerDirect.js 874 kB 874 kB
withRouter.js 874 kB 874 kB
Overall change 4.33 MB 4.33 MB

@ijjk
Copy link
Member

ijjk commented May 25, 2020

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
buildDuration 12s 12s -46ms
nodeModulesSize 66.4 MB 66.4 MB
Page Load Tests Overall increase ✓
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
/ failed reqs 0 0
/ total time (seconds) 2.049 2.071 ⚠️ +0.02
/ avg req/sec 1220.14 1206.86 -13.28
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.169 1.144 -0.03
/error-in-render avg req/sec 2139.04 2185.86 ⚠️ +46.82
Client Bundles (main, webpack, commons)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.js gzip 6.59 kB 6.59 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..1e23.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.module.js gzip 5.67 kB 5.67 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.92 kB 6.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.06 kB 2.06 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.22 kB 8.22 kB
Client Pages Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.52 kB 1.52 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Rendered Page Sizes
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
index.html gzip 927 B 927 B
link.html gzip 937 B 937 B
withRouter.html gzip 924 B 924 B
Overall change 2.79 kB 2.79 kB

Serverless Mode
General
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
buildDuration 12.7s 12.7s -33ms
nodeModulesSize 66.4 MB 66.4 MB
Client Bundles (main, webpack, commons)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.js gzip 6.59 kB 6.59 kB
webpack-HASH.js gzip 746 B 746 B
de003c3a9d30..1e23.js gzip 10.5 kB 10.5 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 57 kB 57 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
main-HASH.module.js gzip 5.67 kB 5.67 kB
webpack-HASH..dule.js gzip 746 B 746 B
de003c3a9d30..dule.js gzip 6.92 kB 6.92 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 52.5 kB 52.5 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
polyfills-HASH.js gzip 26.3 kB 26.3 kB
Overall change 26.3 kB 26.3 kB
Client Pages
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.js gzip 1.26 kB 1.26 kB
_error.js gzip 3.25 kB 3.25 kB
hooks.js gzip 881 B 881 B
index.js gzip 222 B 222 B
link.js gzip 2.06 kB 2.06 kB
routerDirect.js gzip 279 B 279 B
withRouter.js gzip 278 B 278 B
Overall change 8.22 kB 8.22 kB
Client Pages Modern
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_app.module.js gzip 604 B 604 B
_error.module.js gzip 2.04 kB 2.04 kB
hooks.module.js gzip 383 B 383 B
index.module.js gzip 223 B 223 B
link.module.js gzip 1.52 kB 1.52 kB
routerDirect..dule.js gzip 281 B 281 B
withRouter.m..dule.js gzip 278 B 278 B
Overall change 5.33 kB 5.33 kB
Client Build Manifests
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Serverless bundles
zeit/next.js canary hunter-college-ossd-spr-2020/next.js done-with-mongodb Change
_error.js 844 kB 844 kB
404.html 4.18 kB 4.18 kB
hooks.html 3.81 kB 3.81 kB
index.js 844 kB 844 kB
link.js 882 kB 882 kB
routerDirect.js 874 kB 874 kB
withRouter.js 874 kB 874 kB
Overall change 4.33 MB 4.33 MB

@sdhani
Copy link
Contributor

sdhani commented May 29, 2020

Made some changes to the readme and code, let me know if there are any other changes that I should make! 🙂

@lfades
Copy link
Member

lfades commented May 29, 2020

Reviewing, I'm going to update this example and then merge 😌

@lfades
Copy link
Member

lfades commented May 30, 2020

@MichelleLucero Looks like contributions are disabled for the PR, can you enable them or invite me to the repo so I can push a bunch of stuff 🙏

lfades
lfades previously approved these changes May 30, 2020
Copy link
Member

@lfades lfades left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the example 💯 - I've done the following updates:

  • Renamed the example to with-mongodb-mongoose simply because Mongoose adds a bunch of stuff and works very differently to the mongodb driver for Node.js
  • Updated the readme to be more clear on the steps, and I also removed the seed file and the step for it, it was very unclear to me about how to use it, so better to not have it. Free welcome to add it again in the future but with a script.
  • Removed VERCEL_URL and updated the places that used it to access the DB directly.
  • Removed SSG from the edit page and replaced it with SWR as a page like that should not cache the data.
  • Added a temporal vercel.json and deploy button, the deploy button will use the env defined in vercel.json to require you the environment variable before adding the deployment, soon this won't be needed and vercel.json can be removed again.

Copy link
Member

@lfades lfades left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving again after fixing the linter

@lfades lfades merged commit 3dbddfa into vercel:canary May 30, 2020
rokinsky pushed a commit to rokinsky/next.js that referenced this pull request Jul 11, 2020
* created with-mongodb, Next.js + MongoDB

Co-authored-by: Shania Dhani <31454777+sdhani@users.noreply.github.com>
Co-authored-by: Michelle Lucero <31500626+MichelleLucero@users.noreply.github.com>
Co-authored-by: Chi Shing Lee <60354073+chislee0708@users.noreply.github.com>

* Update examples/with-mongodb/README.md

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>

* modified for dotenv and environment var setup

* removed extra instructions on readme, linked it to the MongoDB guides

* changes to environment var

* replaced document with react logic

* removed Pet header

* removed isomorphic-unfetch

* replaced getInitialProps with getStaticProps (SSG)

* removed console log

* deleted next.config.js file

* fixed prettier styling

* fixed link 404 server rendering issue

* modified server path for delete/edit

* fixed prettier styling

* fixed a typo

* change .env to .env.local

Co-authored-by: Joe Haddad <timer150@gmail.com>

* fixed typo, change .env to .env.local

Co-authored-by: Joe Haddad <timer150@gmail.com>

* change .env to .env.local

Co-authored-by: Joe Haddad <timer150@gmail.com>

* Update examples/with-mongodb/package.json

Co-authored-by: Joe Haddad <timer150@gmail.com>

* removed dotenv dev dependency

Co-authored-by: Joe Haddad <timer150@gmail.com>

* cleaned up code and instructions

* Update examples/with-mongodb/.gitignore

Co-authored-by: Luis Alvarez D. <luis@vercel.com>

* minor changes to code style and logic

* Updated index page and .env.local.example

* Updated new page

* Don't use SSG for the edit page

* Fixed revalidation issue

* Use es6 for the model

* Updated edit page

* Removed VERCEL_URL

* Updated readme and renamed env

* Added temporal vercel.json

* Removed seed until added with a script

* Updated package.json

* Renamed example in readme

* Renamed example

* Lint fix

Co-authored-by: liulanz <zhengliulan@gmail.com>
Co-authored-by: Shania Dhani <31454777+sdhani@users.noreply.github.com>
Co-authored-by: Chi Shing Lee <60354073+chislee0708@users.noreply.github.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
Co-authored-by: sdhani <shania.dhani46@myhunter.cuny.edu>
Co-authored-by: liulanz <37808313+liulanz@users.noreply.github.com>
Co-authored-by: Joe Haddad <timer150@gmail.com>
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
@vercel vercel locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants