Code Monkey home page Code Monkey logo

nextjs-pwa-template's Introduction

Cats Realm

Cats Realm 🐾

A Solid Foundation for Building Scalable and Efficient Progressive Web Application!

⏩ Table of contents

πŸ“– About the Project

image

Next.js PWA template 🐾 is a starter template that provides a comprehensive setup for building a progressive web app (PWA) using the Next.js framework. Don't worry about the configuration πŸ”¨ this template will take care of that, focus on your codes⌨️ and project ideasπŸ’‘

This template includes a pre-configured setup for service workers, offline support, and manifest files, making it easy for developers to create a high-performing PWA with minimal setup. The template also includes a basic layout and routing system, along with some basic components and styles, to help developers get started quickly. This template give you the end to end type safety. Additionally, it includes a range of popular libraries and tools, such as Prettier, ESLint, and Tailwind CSS, to ensure that the code is well-formatted and follows best practices. With the help of this template, developers can easily create a fast and reliable PWA that can work seamlessly across all devices.

πŸ“· Gallery

πŸ–₯️ Desktop

πŸŒ‘ Dark mode

Dark Β  Β  Β  Dark

πŸ”¦ Light mode

Light Β  Β  Β  Light

πŸ“±Mobile

πŸŒ‘ Dark mode

Dark Β  Β  Β  Dark

πŸ”¦ Light mode

Dark Β  Β  Β  Dark

πŸ” Features

  • 🐾 Cats Realm PWA using Next 13
  • πŸŒ— Awesome dark/light themes
  • πŸ“± Native like mobile experience
  • 🎯 Make Development simple
  • 🐞 Vscode debugging
  • πŸ”₯ Hot Module Replacement(HMR)
  • πŸ’ͺ Eslint, Prettier and Airbnb make your code stronger
  • πŸ–₯ Build your application for multi-platform

πŸ—Ό Lighthouse Performance

The Next.js PWA Template achieve a 100% score in Google Lighthouse

Lighthouse

πŸ›  Built With

Next.js PWA Template Built With











πŸƒβ€β™‚οΈ Getting Started

These instructions will get you a copy of the Next.js PWA Template and running on your local machine for development and testing purposes. See Deploy for notes on how to lunch your PWA app in live.

πŸ“š Before You Begin

Before you begin i recommend you read about the basic building blocks that assemble a Next.js PWA Template:

πŸ–₯️ Prerequisites

Make sure you have installed all of the following prerequisites on your development machine:

NOTE: This project requires NodeJS (version 14 or later) and NPM. Node and NPM are really easy to install.

πŸ›« Quick Start

There are several ways you can get the Next.js PWA Template:

πŸŒ€ Cloning The GitHub Repository

The recommended way to get Next.js PWA Template is to use git to directly clone the repository:

# Clone the project
git clone https://github.com/AjayKanniyappan/nextjs-pwa-template.git <your-project-name>

# Enter the project directory
cd <your-project-name>

This will clone the latest version of the Next.js PWA Template repository to a nextjs-pwa-template folder.

πŸ—ƒοΈ Downloading The Repository Zip File

Another way to use the Next.js PWA Template is to download a zip copy from the main branch on GitHub. You can also do this using the wget command:

wget https://github.com/AjayKanniyappan/nextjs-pwa-template/archive/refs/heads/main.zip -O nextjs-pwa-template-main.zip; unzip nextjs-pwa-template-main.zip; rm nextjs-pwa-template-main.zip

Don't forget to rename nextjs-pwa-template-main after your project name.

🧰 Quick Install

Once you've downloaded the Template and installed all the prerequisites, you're just a few steps away from starting to develop your Progressive Web App using Next.js.

The Template comes pre-bundled with a package.json file that contain the list of modules you need to start your application.

To install the dependencies, run this in the application folder from the command-line:

# Install dependency
npm install

Or if you prefer using Yarn:

# Install dependency
yarn install

This command does a few things:

  • First it will install the dependencies needed for the application to run.
  • If you're running in a development environment, it will then also install development dependencies needed for testing and running your application.

πŸ“‚ Directory Structure

Next.js PWA Template files and folder structure.

+β”œβ”€β”€ .husky                       Automate your git commits
 β”œβ”€β”€ .next                        Contains the minimized version of the source code
+β”œβ”€β”€ .vscode                      vscode debug folder and extension support
 β”‚
+β”œβ”€β”€ public                       Project assets folder
 β”‚   β”œβ”€β”€ icons                    Icon sets folder
 β”‚   β”‚  └── NxN.png               Different pixel png's
 β”‚   └── manifest.json            Manifest for PWA application
 β”‚
+β”œβ”€β”€ src                          Source code folder
 β”‚   β”œβ”€β”€ common                   It contains common data
 β”‚   β”œβ”€β”€ components               This folder consists of a collection of UI components
 β”‚   β”œβ”€β”€ constants                It contains constant urls and data
 β”‚   β”œβ”€β”€ hooks                    It contains custom hooks for all pages
 β”‚   β”œβ”€β”€ layouts                  It contains page layout
 β”‚   β”œβ”€β”€ pages                    Pages and indicate the routes
+β”‚   β”‚   └── index.tsx            Starting point of the application
 β”‚   β”œβ”€β”€ services                 It contains API Services
 β”‚   β”œβ”€β”€ styles                   It contains css styles
 β”‚   β”œβ”€β”€ svg                      It contains SVG Vectors
 β”‚   β”œβ”€β”€ types                    Typescript types declaration folder
 β”‚   └── utils                    It contains a set of utility functions
 β”‚
 β”œβ”€β”€ .editorconfig                EditorConfig for defining coding styles
 β”œβ”€β”€ .eslintrc.json               Eslint configurations
 β”œβ”€β”€ .prettierrc                  prettier code formatter
+β”œβ”€β”€ next.config.js               Next.js PWA configurations
+β”œβ”€β”€ package.json                 Package.json for development
 |── postcss.config.js            Post CSS configurations
+β”œβ”€β”€ tailwind.config.js           Tailwind CSS configurations
 β”œβ”€β”€ tsconfig.json                TypeScript Configuration
+└── tsconfig.node.json           TypeScript paths

πŸ‘¨β€πŸ’» Starting Development

Use your favorite JavaScript Package Managers npm or yarn or pnpm

πŸƒ Running Your Application

Run your application using npm:

npm run dev

Or if you prefer using Yarn:

yarn dev

image

Your Next.js application should run on port 5050 with the development environment configuration, so in your browser just go to http://localhost:5050

That's it! Your application should be running. To proceed with your development, check the other sections in this documentation. If you encounter any problems, Feel free to check issues page.

πŸ›¬ Change Port Number

If the localhost 5050 port number already in use! or if you like to change your Next.js application number.

Go to πŸ‘‰ package.json and change the port number 5050 to your-port-number

port

πŸ†š Vscode Debugging

This guide goes over how to start VSCode debugging your Next.js, react Project.

you can easily debug this nextjs-pwa-template.

To bring up the Run and Debug view, select the Run and Debug icon in the Activity Bar on the side of VS Code. You can also use the keyboard shortcut Ctrl+Shift+D.

Click the button or press F5 to start debugging

client:debug

🧹 Clean Cache

If you want clean the cache files and node_modules cache run this below command πŸ‘‡:

npm run clean

NOTE: It will remove your node_module folder, build files and env files.

πŸ’ˆ Style your Code

The Next.js PWA Template has Eslint, Prettier and Airbnb Configurations, this will help you to Style your code and syntax check and more.

Eslint will check syntax, find problems, and enforce code style of your code.

Prettier will format your code style.

All you have to do is run this below command πŸ‘‡:

npm run lint

NOTE: This command show you the warnings and errors in your code.

πŸ›°οΈ Git Commits

Automate your Git commits using Husky, and don't commit or push the bad code in git.

Husky improves your commits and more, You can use it to lint your commit messages, run tests, lint code, etc... when you commit or push. Husky supports all Git hooks.

Run below command πŸ‘‡ to prepare Husky:

npm run prepare

See docs and more about Husky.

That's it! Your application should be running. To proceed with your development, check the other sections in this documentation. If you encounter any problems, Feel free to check issues page.

🚒 Deploy your own

Congratulations, you are ready to deploy your Next.js PWA Template to production. This document will teach how to deploy vercel or self-hosted.

πŸ”Ό Vercel

The easiest way to deploy Next.js to production is to use the Vercel platform developed by the creators of Next.js.

NOTE: If you want to read more about vercel, kindly read this πŸ™ Documentation.

πŸ‘» Self-Hosting

Next.js PWA Template can be deployed to any hosting provider that supports Node.js.

If you’ve followed the instructions so far, your package.json should have the following build and start scripts:

"scripts": {
    "build": "next build",
    "clean": "git clean -dfX",
    "dev": "next dev -p 5050",
    "lint": "next lint --fix --max-warnings 0 .",
    "prepare": "husky install",
    "start": "next start -p 5050"
  }
npm run build

In your own hosting provider, run the build script once, which builds the production application in the .next folder.

After building, the start script starts a Node.js server that supports hybrid pages, serving both statically generated and server-side rendered pages, and API Routes.

npm run start

NOTE: If you want to read more about deployment, kindly read this πŸ™ Documentation.

🀝 Contributing

Contributions, issues and feature requests are welcome! Just be sure to read the contributing document to get started. Feel free to check issues page.

πŸ’– Show your support

I hope πŸ™ it will helped you! Give a ⭐️ to support this project!

If you like πŸ’— the project, there is other way to support us

  • Tweet about it
  • Refer this project in your project's readme
  • Mention the project at local meetups and tell your friends/colleagues

β˜• Donate

Donations will help us to ensure the following:

  • ⚑ Quick responses to issues, bug reports and help requests
  • βž• Adding new features
  • βš’οΈ Long term maintenance of the project

πŸ› οΈ Author

πŸ‘¨β€πŸ’» Ajay Kanniyappan

πŸ“ License

MIT License Β© Ajay Kanniyappan

nextjs-pwa-template's People

Contributors

ajaykanniyappan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nextjs-pwa-template's Issues

Implement admin page

  • Add admins collection to appwrite
  • Either allow all admins' permissions to be able to change globals collection Or if not possible:
    • Implement a server API endpoint that checks if user is admin and changes globals using the server API key
  • If logged in user is an admin show Admin page link in app's nav bar
  • Implement admin page by giving admin access to change any field in globals table
  • Later also could add functionality to add or remove other admins

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.