A full-fledged blogging RESTFul API, built with TypeScript, Express.js, and Prisma PostgreSQL.
Check out the live version deployed here.
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).
- ✅ 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.
- Clone the repository:
git clone https://github.com/ahmadnourallah/blogify- Install dependencies:
npm installBefore 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 runningnpm 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.
You can fire up the development server using:
npm run devBuilding the application can be done by running:
npm run buildYou can preview the production build through:
npm run startMoreover, you can use npm run purge to empty all tables and npm run seed to create the default admin account.
The system is built with the latest technologies:
- TypeScript
- Node.js
- Express.js
- Prisma
- Passport.js
- Swagger UI
- Express Validator
This project is licensed under the GNU GPLv3 License - see the LICENSE.md file for details.