Giter Site home page Giter Site logo

chauduong1192 / web-next Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 0.0 3.16 MB

Making a web base on nextjs

Home Page: https://web-next.herokuapp.com/

JavaScript 22.21% TypeScript 74.01% CSS 2.94% Dockerfile 0.84%
nextjs reactjs redux i18next sass postcss taildwind bootstrap4 react-hooks husky axios styled-jsx typescript pwa server-side-rendering webpack4 babel7 tslint cache-server

web-next's Introduction

Web-next

The source code using nextjs, reactjs, redux, es6, ts, express, eslint, typescript, jest..

Links

Folder Structure

Our source is created by CNA, after createing it should look something like:

├── node_modules
    ├── [...]
├── __tests__
├── .github
├── apis
├── components
    ├── Common
    └── Component1
    └── Component2
├── redux
├── server
    ├── routers
    ├── index.js
├── next.config.js
├── package.json
├── pages
    └── index.js
├── public
    └── fonts
    └── icons
    └── images
    └── locales
    └── styles
├── templates
    └── components
    └── redux
└── yarn.lock
├── README.md

Routing in Next.js is based on the file system, so ./pages/index.js maps to the / route and ./pages/about.js would map to /about.

Now we are using the custom server that using Express, so if you want to modify routers just focus on ./server/routes/prettyUrlRouter.ts

The ./public directory maps to /public in the next server, so you can put all your other static resources like images or compiled CSS in there.

Environment Variables

See .env for development defaults.

Variable Notes
NODE_ENV Node environment variables. Default: development
HOST Host of app. Default: localhost
PORT Port of app. Default: 3000
API_URL Url api service. Need to change this if you have other url for api

Prerequisites

  • NodeJS, version >= 10.0.0 . (I use nvm to manage Node versions — brew install nvm.)

I am using yarn to install the package.

  • npm install -g yarn

Install

yarn

Run the app

Running the app with the dev environment

yarn dev

Running the app with the production environment

yarn prod

TROUBLESHOOTING NOTE: If you are having trouble running the app for the first time please delete the node_module and run yarn again.

Running Tests

yarn test

Running Generate Component or Redux template

Generate component

yarn gen type_of_gen type_of_component component_name

type_of_gen: Type of generator as component, redux. type_of_component: Type of component as single, many.

Ex: yarn gen component single ComponentA

Running Linter

yarn lint

Running Bunddle Analyze

yarn analyze

Redux dev tools

Add details of how to access the app from within Chrome

To view the state in the app install the Redux dev tools Chrome plugin.

Question and Issues

(https://github.com/chauduong1192/web-next/issues)

web-next's People

Contributors

chauduong1192 avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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