Coder Social home page Coder Social logo

tiny-site-backend's Introduction

Tiny Site Backend Setup Guide

This README provides step-by-step instructions for setting up the Tiny Site Backend on your local development environment. The Tiny Site Backend is built using the Go programming language, PostgreSQL for the database, and Google authentication for authentication. Before you begin, ensure that you have the following prerequisites installed on your system:

  1. Go 1.21 or higher
  2. PostgreSQL 15 or higher
  3. pgAdmin (optional but recommended for database management)

Prerequisites

Go 1.21

Make sure you have Go version 1.21 or higher installed on your system. You can download and install Go from the official website: Go Downloads

PostgreSQL

You will need PostgreSQL as the database for the Tiny Site Backend. You can download and install PostgreSQL from the official website: PostgreSQL Downloads

pgAdmin (Optional)

pgAdmin is a popular database management tool for PostgreSQL. It is recommended to install pgAdmin for easier database management. You can download and install pgAdmin from the official website: pgAdmin Downloads

Setup Instructions

  1. Clone the Tiny Site Backend repository from GitHub:

    git clone https://github.com/Real-Dev-Squad/tiny-site-backend.git
  2. Navigate to the project directory:

    cd tiny-site-backend
  3. Create a .env file for your local development environment. You can use the sample .env file provided in the environments directory as a template. Copy the dev.env file to .env:

    cp environments/dev.env .env

    Edit the .env file and configure the environment variables according to your local setup. Make sure to set the database connection details and Google OAuth credentials.

  4. Setting Up Google OAuth

    • Go to the Google Developers Console.

    • Click on "Select a Project" in the top navigation and create a new project if you don't have one.

    • In the left sidebar, click on "APIs & Services" and then "Credentials."

    • Click on "Create Credentials" and select "OAuth client ID."

    • Choose "Web application" as the application type.

    • In the "Authorized JavaScript origins" field, add http://localhost:8000 since this is your local development environment.

    • In the "Authorized redirect URIs" field, add the URI where Google should redirect after authentication. For local development, use http://localhost:8000/auth/google/callback.

    • Click the "Create" button.

    • You will be provided with a client ID and client secret. Add these values to your .env file that you created earlier:

      GOOGLE_CLIENT_ID=your-client-id
      GOOGLE_CLIENT_SECRET=your-client-secret
      
    • Save the changes to your .env file.

  5. Create the PostgreSQL database for the project. You can use pgAdmin or command-line tools to create the database. Update the .env file with the database connection details.

    DB_URL=postgres://username:password@host:port/database_name
    TEST_DB_URL=postgres://username:password@host:port/test_database_name
    
  6. Install the Go project dependencies:

    go mod download
  7. Build and run the Tiny Site Backend:

    go run main.go
  • Use Air for hot reloading

    go get -u github.com/cosmtrek/air
    air

    The backend server should now be running at http://localhost:8000.

  1. Access the Tiny Site Backend API via a web browser or API client, and start developing your application.

Usage

You can access the Tiny Site Backend API at http://localhost:8000 once the server is running. Refer to the project's documentation or API endpoints for more information on how to interact with the backend.

tiny-site-backend's People

Contributors

vinit717 avatar sahsisunny avatar prakashchoudhary07 avatar iamitprakash avatar lakshayman avatar samyakshah3008 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.