Skip to content

katiaipduarte/blog-app

Repository files navigation

Blog App

Welcome to my Blog App, where you can see the latest post or read all of them, and also write comments.

Demo at: blog-app-liard.vercel.app

App created using Next.js 11, TypeScript, styled-components and for testing Jest. Thank you for using my app.

Note: To run this project be sure to have a Node version installed that is 12.x or higher

Table of Contents

Installation

To use this app, first clone from GitHub via 'git clone https://github.com/katiaipduarte/blog-app.git' at your terminal, cd to the new directory, then run npm run install:npm. Before running this project, you will need to create a .env.local file, with the same env as the ones in the .env.example. At last, run npm run dev to launch your http server.

For this project to run you need to run the API via json-server https://github.com/LetsGetChecked/developer-challenge-api.

Future Work

[ ] Add more unit tests and e2e ones
[ ] Add page transition loader
[ ] Add authentication
[ ] Add possibility to write posts

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/katiaipduarte/blog-app. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The code is available as open source under the terms of the MIT License.

Folder Structure

blog-app/
    .jest/
    components/
        common/
        templates/
        ui/
    constants/
    interfaces/
    lib/
        context/
        hooks/
        seo/
    pages/
    public/
    styles/
    utils/

For the project to build, these files must exist with exact filenames:

  • .jest contains a single file for the setup of the plugins/npm packages used in the unit tests.
  • components is the folder that houses all the components used. It's divided for now into 5 modules.
    • common: components that are used all the time when we render a page.
    • templates: pages templates.
    • ui: small components ui components with or without logic.
  • constants is the folder with all the enums or const objects used in the components.
  • interfaces is the folder with all the interfaces/type files used in the components.
  • lib is the folder for some hooks, SEO and context provider.
  • pages is the folder that contains the files with the initial logic used for each route.
  • public the folder only contains the favicon images.
  • style is the folder with reset, themes and any other style rules shared by all components.
  • utils is the folder with helper functions.

Environment variables

NEXT_PUBLIC_APP_URL=

NEXT_PUBLIC_API_ENDPOINT=

Available Scripts

npm run install:npm

Clear installation of all node modules.

npm run dev

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

npm run start

Runs the app in the production mode.
Open http://localhost to view it in the browser.

npm run find:unused

next-unused is used to find all the unused files in the project.

npm run lint

Automatic linting, with rules to work with TypeScript and React. The node_modules and e2e folders are not included.

This is runned each time you do a commit and a push it to your branch.

For more information see the ESLint documentation.

npm run format

Command to format the code according to the rules that can be found in .prettierrc. The node_modules and e2e folders is not included.

This will be automatically run each time you do a commit.

For more information see the Prettier documentation.

npm run test

Runs all the tests founded.
See the section about running tests for more information.

npm run test:watch

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run test:coverage

Launches the test runner in the interactive watch mode and shows a report with the code coverage for each component.
See the section about running tests for more information.