NanoAPI Docs
Intro to Nano APIGetting StartedDeploying your software with NanoAPIStep 1: Sign Up to NanoAPI (2 min.)Step 2: Search for a Repository (1 min.)Step 3: Build configuration (2 min.)Step 4: Create an API Token (1 min.)Step 5: Set Up Your CI/CD Pipeline (2 min.)Step 6: Push a New Commit (1 min.)Automatic BuildsFAQsNanoAPI versus NetlifyNanoAPI versus VercelNanoAPI versus AWS Lambda

Getting started

Deploying your software with NanoAPI

You can have your first application up and running on NanoAPI in under 10 minutes. Follow the steps below to see how easy it is to get your software configured, built, and deployed.

What you’ll need:

Before you start, please check you have the following:

  • GitHub or GitLab Account:
    • A valid GitHub or GitLab account is required for signing up and granting access permissions to NanoAPI.
  • Repository to Deploy:
    • A repository on GitHub or GitLab that you want to deploy using NanoAPI.
  • Login Credentials:
    • Your GitHub or GitLab username/email and password for authentication during the signup and approval process.

Step 1: Sign Up to NanoAPI (2 min.)

What you’ll need:

  • GitHub or GitLab Account.
  • Login Credentials.
  1. Go to app.nanoapi.io/signup

Sign Up

  1. Choose a Signup Method:
    • You will be presented with options to sign up using different methods. Choose either:
      • GitHub Account: Click on the "Sign up with GitHub" button.
      • GitLab Account: Click on the "Sign up with GitLab" button.
  2. Authenticate with Your Chosen Account:
    • If you selected GitHub:
      • You will be redirected to GitHub’s login page. Enter your GitHub credentials (username/email and password) and click "Sign in."
    • If you selected GitLab:
      • You will be redirected to GitLab’s login page. Enter your GitLab credentials (username/email and password) and click "Sign in."
  3. Grant and Authorize NanoAPI:
    • After logging in, you are asked to authorize NanoAPI to access your GitHub or GitLab account. Click “Grant” to grant acces to your organisations and then review the permissions and click "Authorize" to proceed.

Step 2: Search for a Repository (1 min.)

What you’ll need:

  • Repository to Deploy.
  1. Redirect to Dashboard:
    • After approving access to your GitHub or GitLab account, you will be redirected to the NanoAPI dashboard.
  2. Search for a Repository:
    • On the dashboard, locate the search bar.
    • Enter the name of the repository you want to deploy or the owner’s name in the search bar. This will be mostly: “ownername/reponame” Fresh Login View
  3. Locate the Repository:
    • Browse through the search results to find the repository you are looking for. Refer to the provided image if needed: Repos

Step 3: Build configuration (2 min.)

What you’ll need:

  • Repository to Deploy.
  1. Redirect to Build Config Screen:

    • Click on the "View builds" button at your repository, you will see an option labeled "Create/View build configs." Click on this option.

    Build Config

  1. Build Config Screen:
    • You will be taken to the build config screen.
  2. Create New Build Config:
    • On the build config screen, locate the option to create a new build config.
    • Click on the "Create New" button to start configuring your new service.
  3. Fill in Configuration Details:
    • Provide the necessary details for your build configuration. This may include:
      • Build Name: A unique name for your build configuration.
      • Environment Variables: Any environment variables needed for your service.
      • Build Commands: Commands to build your application.
      • Deployment Settings: Settings specific to your deployment environment.
    • Make sure to fill in all required fields accurately. New Build Config
  4. Save Configuration:
    • Once you have entered all the necessary details, click on the "Save" button to save your build configuration.

Step 4: Create an API Token (1 min.)

What you’ll need:

  • Repository to Deploy.
  1. Navigate to the API Tokens Page:

    • Go to the API Tokens page.
  2. Create a New Token:

    • Click on the "Create a new token" button.

    Token

    • Enter a name for your token.

    Name Token

    • The new token will appear in the upper right corner of the screen.
    • Click on the token to copy it to your clipboard. Many Tokens
  3. Secure Your Token in GitHub or GitLab:

    • Keep the token safe, as it is used to authenticate your service with Nano API.
    • Note that you can create multiple tokens and revoke them anytime.
    1. Add the API Token to Your Repository as a Secret Value:
      • Navigate to your repository on GitHub or GitLab.
      • Go to the "Settings" page.
    2. Add a New Secret:
      • Find the "Secrets" or "Environment Variables" tab.
      • Click on "New Secret" or "Add Secret."
    3. Name and Paste the Secret:
      • Name your secret NANO_API_TOKEN (or another preferred name).
      • Paste the API token as the value for this secret.

Step 5: Set Up Your CI/CD Pipeline (2 min.)

What you’ll need:

  • GitHub or GitLab Account.

  • Repository to Deploy.

  • Create a Workflow File:

    • For GitHub: In your repository, navigate to .github/workflows.
    • For GitLab: In your repository, navigate to .gitlab-ci.yml.
    • Create a new file named deploy_using_nano.yml.
  • Add Workflow Configuration:

    • Copy and paste the following content into deploy_using_nano.yml. This file should exist within the .github/workflows or the root directory of your repository.

      Untitled

    • Copy this into your new GitHub CI file:

      # .github/workflows/deploy-nanoapi.yml
      name: nanoapi_build_and_deploy
      on: [push]
      jobs:
      ci:
      runs-on: ubuntu-latest
      steps:
      - name: Build and deploy via Nano API
      uses: Nano-API/Deploy@version/0
      with:
      apiKey: ${{ secrets.NANO_API_TOKEN }} # Your Nano API token, stored in Github secrets
      buildConfigId: '<your_build_config_id>'
      commitSha: ${{ github.sha }}

Note: Replace <your_build_config_id> with the ID of the build configuration you created in Step 3.

Step 6: Push a New Commit (1 min.)

What you’ll need:

  • GitHub or GitLab Account.
  • Repository to Deploy.
  1. Make Changes:
    • Make any necessary changes to your code or repository.
  2. Commit and Push:
    • Commit your changes.
    • Push the commit to your repository.
  3. Trigger the Workflow:
    • The push will trigger the CI/CD pipeline.
    • Monitor the build and deploy process in the Actions tab of your repository.

Wrap Up

You have successfully set up automatic builds and deployments for your service using Nano API in under 10 minutes. With this setup, every time you push a new commit, Nano API will automatically build and deploy your service, facilitating quick iterations and deployments.