Giter Site home page Giter Site logo

imobiliaria-ev's Introduction

ES2 Project with Next JS 12+, Chakra UI and TypeScript

Boilerplate used - Github

Features

Developer experience first:

  • โšก Next.js for Static Site Generator
  • ๐Ÿ”ฅ Type checking TypeScript
  • โœ… Strict Mode for TypeScript and React 18
  • ๐Ÿ“ Linter with ESLint (default NextJS, NextJS Core Web Vitals, Tailwind CSS and Airbnb configuration)
  • ๐Ÿ’– Code Formatter with Prettier
  • ๐ŸฆŠ Husky for Git Hooks
  • ๐Ÿšซ Lint-staged for running linters on Git staged files
  • ๐Ÿš“ Lint git commit with Commitlint
  • ๐Ÿฆบ Unit Testing with Jest and React Testing Library
  • ๐Ÿงช E2E Testing with Cypress
  • ๐Ÿ’ก Absolute Imports using @ prefix
  • ๐Ÿ—‚ VSCode configuration: Debug, Settings, Tasks and extension for PostCSS, ESLint, Prettier, TypeScript, Jest
  • ๐Ÿค– SEO metadata, JSON-LD and Open Graph tags with Next SEO
  • โš™๏ธ Bundler Analyzer
  • ๐Ÿ–ฑ๏ธ One click deployment with Vercel or Netlify (or manual deployment to any hosting services)
  • ๐ŸŒˆ Include a FREE minimalist theme
  • ๐Ÿ’ฏ Maximize lighthouse score

Built-in feature from Next.js:

  • โ˜• Minify HTML & CSS
  • ๐Ÿ’จ Live reload
  • โœ… Cache busting

Philosophy

  • Minimal code
  • SEO-friendly
  • ๐Ÿš€ Production-ready

Requirements

  • Node.js 14+ and npm

Getting started

Run the following command on your local environment:

git clone --depth=1 https://github.com/ixartz/Next-js-Boilerplate.git my-project-name
cd my-project-name
yarn

Then, you can run locally in development mode with live reload:

yarn dev

Open http://localhost:3000 with your favorite browser to see your project.

Setting the database

First things first, create your .env file by running the following command:

$ cp .env.example .env

Then you need to copy the environment values from the docker-compose.yml file to fill in the default values of the DATABASE_URL variable on .env file:

DATABASE_URL="postgresql://user:pass@host:5432/dbname"

To get your host ip, simply inspect all your docker containers and copy the one corresponding to your db

$ docker inspect --format='{{.Name}} {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -q)

By completing the filling process on the .env file, run the following command to run the migrations over your database:

$ npx prisma migrate dev

Use this command to generate DB types in typescript:

$ npx prisma generate

(Optional) To populate the database run this:

$ npm run seed

To visualize the database using prisma studio:

$ npx prisma studio 

Project Structure

.
โ”œโ”€โ”€ README.md                       # README file
โ”œโ”€โ”€ __mocks__                       # Mocks for testing
โ”œโ”€โ”€ .github                         # GitHub folder
โ”œโ”€โ”€ .husky                          # Husky configuration
โ”œโ”€โ”€ .vscode                         # VSCode configuration
โ”œโ”€โ”€ prisma                          # Database migration folder
โ”‚   โ”œโ”€โ”€ migrations                  # migrations and respective sql files
โ”œโ”€โ”€ public                          # Public assets folder
โ”œโ”€โ”€ src
โ”‚   โ”œโ”€โ”€ layouts                     # Layouts components
โ”‚   โ”œโ”€โ”€ pages                       # Next JS Pages
โ”‚   โ”œโ”€โ”€ pages.test                  # Next JS Pages tests (this avoid test to treated as a Next.js pages)
โ”‚   โ”œโ”€โ”€ styles                      # Styles folder
โ”‚   โ”œโ”€โ”€ templates                   # Default template
โ”‚   โ””โ”€โ”€ utils                       # Utility functions
โ”œโ”€โ”€ tailwind.config.js              # Tailwind CSS configuration
โ””โ”€โ”€ tsconfig.json                   # TypeScript configuration

Customization

You can easily configure Next js Boilerplate. Please change the following file:

  • public/apple-touch-icon.png, public/favicon.ico, public/favicon-16x16.png and public/favicon-32x32.png: your website favicon, you can generate from https://favicon.io/favicon-converter/
  • src/styles/global.css: your CSS file using Tailwind CSS
  • src/utils/AppConfig.ts: configuration file
  • src/templates/Main.tsx: default theme

Deploy to production

You can see the results locally in production mode with:

$ yarn build
$ yarn start

The generated HTML and CSS files are minified (built-in feature from Next js). It will also removed unused CSS from Tailwind CSS.

You can create an optimized production build with:

yarn build-prod

Now, your blog is ready to be deployed. All generated files are located at out folder, which you can deploy with any hosting service.

Testing

All tests are colocated with the source code inside the same directory. So, it makes it easier to find them. Unfortunately, it is not possible with the pages folder which is used by Next.js for routing. So, what is why we have a pages.test folder to write tests from files located in pages folder.

imobiliaria-ev's People

Contributors

antoniohamilton avatar arfianadam avatar brabec avatar co0ki3 avatar edilsonjunior-2 avatar ingokpp avatar ixartz avatar luisfelipeufs avatar max-programming avatar mrhbs avatar pedroailan avatar rafahsena avatar riolly avatar tonyaellie avatar zeevo 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.