Skip to content

Latest commit

 

History

History
41 lines (21 loc) · 1.58 KB

File metadata and controls

41 lines (21 loc) · 1.58 KB

StepUP DB

StepUp scrapes the web for ecommerce stores along with relevant sustainability scores and visualize it across a map

stepup-project-graphic

Next.js with TypeScript, MongoDB, HttpReact, TailwindCSS and DaisyUI

A Next.js app with a serverless backend using MongoDB. A template that can be used to quickly bootstrap new Next.js project. It also has Tailwind configured with Postcss and DaisyUI

Clone/(Download as zip) this repo, then:

npm install

or

yarn install

When starting the dev server, pass an env. variable with the URI for the MongoDB connection.

MONGO_URI="my-mongodb-uri" npm run dev

You can also place that variable inside a .ENV file (don't forget to add it to your .gitignore file)

Since serverless doesn't save variables after an api call, you need to create the connection inside each request if it's not created yet, you can do this by calling the function connectToDatabase that is inside utils.

And you are ready to go:)

(It has an example using Typescript with Mongoose models in the api handlers).


I created three of the libraries used in this project:

http-react: React hooks for Data fetching react-kuh: TypeScript-ready React (kinda) useful hooks next-api-validation: Validate HTTP requests inside Next.js API endpoints

Live preview