Appointment Booking Microservice using Javascript Fullstack

Jan 12, 2020
2 min read
  • #zeit
  • #microservice
  • #serverless
  • #nodejs
  • #angularjs
  • #mongodb
  • #appointment booking

Sometime before I created an appointment booking app using AngularJS and it was huge popular amoung my readers. So I decided to re-create the same using the microservice architecture


  • This reduces hosting cost
  • Easy to deploy
  • Superfast
  • No architecture to maintain
  • No softwares to install
Live Demo

This time we will use MLab for MongoDB (a self hosted mongodb database as service)


  1. Download now-cli npm i -g now
  2. Clone or Download the project from github. Then just run the command now

Everything else will be taken care and you must see a url returned by now-cli and your app is live


Now is the service which will host our microservice. Inside now.json we define all the instructions to setup our microservice at Now server

  "name": "appointment",
  "version": 2,
  "env": {
    "MONGODB_URI": "@appointment"
  "builds": [
      "src": "www/**",
      "use": "@now/static"
      "src": "api/**/*.js",
      "use": "@now/node"
  "routes": [
      "src": "/",
      "dest": "www/index.html"
      "src": "/app.js",
      "dest": "www/app.js"
      "src": "/css/(.*)",
      "dest": "/www/css/$1"
      "src": "/js/(.*)",
      "dest": "/www/js/$1"
      "src": "/app/(.*)",
      "dest": "/www/app/$1"
      "src": "/images/(.*)",
      "dest": "/www/images/$1"
      "src": "/api",
      "dest": "api/*"


api/appointments/index This is the only file for our microservice. here we

  1. Define the database connection
  2. Initialize the database models
  3. Execute incoming get/post requests from clients

api/appointments/model We are using a single collection for this application named appointment. That collection definition/model is defined in this file

var appointmentSchema = new mongoose.Schema({
  date: Date,
  name: String,
  phone: String,
  status: Boolean

client/index.html The starting point for our application front end.

client/app.js It starts the angular module and links the required external dependencies.

client/customer.html Appointment details with customer information.

client/main.css All css files for main.html

client/main.html Application’s front end

client/main.js It implements required logics.

server/index.js It creates the appointments ReST API routes.

server/api/appointment/index.js The appointments ReST API routes are defined here.

server/api/appointment/model.js Defines the appointments database model.

package.json It carries node dependencies which are required for this application.