Skip to content

ahmadnourallah/blogify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

117 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blogify

A full-fledged blogging RESTFul API, built with TypeScript, Express.js, and Prisma PostgreSQL.

Demo

Check out the live version deployed here.

Description

Built with modular Express.js and type-safe TypeScript, Blogify is a blogging RESTFul API that offers all you need to start blogging: posts, comments and categories.

Blogify is highly scalable and customizable, thanks to the unopinionated nature of Express.js. It supports role-based, JWT authentication and thumbnail (image) upload.

Blogify is built to be easily integrated into and used with any frontend system effortlessly. Also, it is thoroughly documented with Swagger UI (check out the live docs here).

Features

  • ✅ RESTFul API with support for posts, comments and categories.
  • ✅ Role-based, JWT authentication using Passport.js.
  • ✅ Thumbnail upload.
  • ✅ Support for JSON and multipart form data.
  • ✅ Thorough documentation using Swagger UI.
  • ✅ Effortless database migration and deployment with Prisma and a custom seeding and purging script (src/seed.ts).
  • ✅ Comprehensive input validation and sanitization.

Getting Started

Installation

  1. Clone the repository:
git clone https://github.com/ahmadnourallah/blogify
  1. Install dependencies:
npm install

Environment Variables

Before starting the server, you should make sure to define the following environment variables:

  • PORT: The port which the development server will listen on. Default: 3000.
  • DB_URL: The postgresql url of the database. A postgresql database url has the following format: postgres://username:password@hostname:5432/database.
  • JWT_SECRET: A confidential cryptographic key used to sign and verify JWTs for authentication. You can generate a random one using: node -e "console.log(require('crypto').randomBytes(32).toString('hex'));".
  • JWT_EXPIRATION_TIME: The period after which a generated JWT expires and has to be resigned. Default: 2d.
  • ADMIN_EMAIL: The autogenerated superuser's email. By running npm run seed, an admin account is generated using the values of this variable and the following ones. Default: admin@gmail.com.
  • ADMIN_PASS: The autogenerated superuser's password. Default: admin123!.
  • ADMIN_NAME: The autogenerated superuser's name. Default: Admin.

WARNING: Do NOT use the default values of ADMIN_EMAIL and ADMIN_PASS in production.

Deployment

You can fire up the development server using:

npm run dev

Building the application can be done by running:

npm run build

You can preview the production build through:

npm run start

Moreover, you can use npm run purge to empty all tables and npm run seed to create the default admin account.

Technologies

The system is built with the latest technologies:

  • TypeScript
  • Node.js
  • Express.js
  • Prisma
  • Passport.js
  • Swagger UI
  • Express Validator

License

This project is licensed under the GNU GPLv3 License - see the LICENSE.md file for details.

About

A full-fledged blogging RESTFul API, built with TypeScript, Express.js, and Prisma PostgreSQL.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors