Web Application

This tutorial will show you how to setup a login system for a vanilla web application using Base.

Set Up

This tutorial is based on the base-app-starter repository that you will need to clone.

$ git clone https://github.com/clay-run/base-app-starter.git
$ cd base-app-starter/ 

Once the repository is closed, you will need to install all the required packages with npm.

$ npm install

Info

If you do not have NPM installed on your machine visit the Get Npm page on npmjs.com

Configuration

In order to run this project, you need a Base.run API Key that looks like sk_xxxxxxx

  1. Create a base named My Web App and open it
  2. Rename the table people and replace it with users
  3. Delete the clearbit_enrichment column
  4. Create a text column named password

Info

Base.run has built-in login and register function that required a users table with both a email and password field. You can read more about it on the API Reference.

Your base should look like the following: Screen Shot 2018-11-20 at 4.51.13 PM

Click on the keys icon at the top right of the screen and copy-paste your Private Key. In the config file at the root of the project, replace the following code with your own Private Key:

export BASE_SECRET_KEY='sk_xxxxxxxxxxxxxx'

Running The App

After installing and configuring the app, you should be able to run it using npm run dev, the app will be listening at http://localhost:8091.

Landing Page: Web Application 2

Login Screen: Web Application 3

Deployment

This app can run in a production. Simply build it using npm run build, and start it using npm run start. The app will be listening on port 3001.

You can easily deploy it using now. Test it at https://base-app-starter.now.sh/.