Skip to content

LIVE NEWS APP with Next.js 13 (TypeScript, StepZen, Tailwind CSS, Dark Mode, GraphQL)

License

Notifications You must be signed in to change notification settings

Priyanshu88/News-App

Repository files navigation

logo

LIVE NEWS APP with Next.JS 13

LIVE NEWS APP with Next.JS 13! Implemented to handle dynamic data and static data alternative to Server Side Rendering and Incremental Static Regeneration. The website is fully responsive and uses Tailwind CSS which further incorporates the feature of dark mode to the app. User can search news with the keywords, categories. Implementation of dynamic page routing and pulling the data from MediaStack News API in efficient and optimized manner has been done to prevernt overloading. Stepzen has been used to launch a GraphQL interface which is queried by FETCH API. Further Typescript is used to reduce the overall number of bugs and errors and the deployed on vercel.


📔 Table of Contents

🌟 About the Project

📷 Screenshots

image

📹 Demo

News-App.Demo.mp4

forthebadge forthebadge forthebadge

👾 Tech Stack

Client
API
GraphQL

Google

🧰 Getting Started

‼️ Prerequisites

  • Sign up for a StepZen account HERE
  • Log in for a MediaStack API account HERE
  • Install Node JS in your computer HERE

🔑 Environment Variables

To run this project, you will need to add the following environment variables to your .env file

STEPZEN_API_KEY

MEDIASTACK_API_KEY

⚙️ Installation

Install my-project with npm

npx create-next-app news-app
cd news-app

Install dependencies

🧪 Install Tailwind CSS with Next.js

Install Tailwind CSS

Install tailwindcss and its peer dependencies via npm, and then run the init command to generate both tailwind.config.js and postcss.config.js.

npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p

Configure your template paths

Add the paths to all of your template files in your tailwind.config.js file.

module.exports = {
  content: [
    "./pages/**/*.{js,ts,jsx,tsx}",
    "./components/**/*.{js,ts,jsx,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

Add the Tailwind directives to your CSS

Add the @tailwind directives for each of Tailwind’s layers to your ./styles/globals.css file.

@tailwind base;
@tailwind components;
@tailwind utilities;

OR

setup directly with configured installation

  npx create-next-app -e with-tailwindcss news-app

Install dependencies

🔶 Other Dependency Info

🏃 Run Locally

Clone the project

  git clone https://github.com/Priyanshu88/News-App.git

Install dependencies This is a Next.js project bootstrapped with create-next-app.

  npm install

Getting Started

Start the server First, run the development server:

  npm run dev

This is a Next.js project bootstrapped with create-next-app.

Open http://localhost:3000 with your browser to see the result.

Convert Next.js12 to Next.js13 by modifying next.config.js with

  experimental: {
    appDir: true,
  }

Create an app folder with page.tsx and delete index.js to avoid conficts. Now, create head.tsx and layout.tsx and import the globals.css in layout file.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.js.

The pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Instagram

👽 API Implementation and StepZen

MediastackAPI

Signup at Medistack platform, copy the API Access API key.

Instagram

Setting Up StepZen

Create an account

  • Sign up for a StepZen account HERE

Running StepZen

Install the CLI

npm install -g stepzen

After installing the CLI, you can connect it to your account.

Start by logging in using the following command:

stepzen login

You'll see a series of command prompts asking for your StepZen account name and admin key:

What is your account name?: {ACCOUNT}
What is your admin key?: {ADMINKEY}

Your Admin Key and API Key**

When you get your account, log in to StepZen and navigate to the StepZen dashboard, where you will find your account name, and the two keys you need for API authentication:

stepzen init

Initialize a StepZen workspace in the current directory.

stepzen init

GET requests

Auto-generate your schemas and resolvers using the following StepZen CLI command:

News

stepzen import curl "http://api.mediastack.com/v1/news?access_key=YOUR_ACCESS_KEY&countries=us%2Cgb&limit=100&offset=0&sort=published_desc"

Deploy

stepzen start

🚩 Deployment

To deploy this project run

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

🤝 Contact

Your Name - @twitter_handle - 2040020@sliet.ac.in

Project Link: https://github.com/Priyanshu88/News-App.git


image

Don't forget to leave a star ⭐️