Skip to content

⚡️Effortless Website Deployment - Build simple, fast, and secure websites without worrying about technical expertise or maintenance.

License

Notifications You must be signed in to change notification settings

devarshishimpi/staticstorm

Repository files navigation

StaticStorm

Unleash the power of simple, fast and secure websites.


🚀 Getting Started

To run the application locally for development purposes, please follow the instructions below:

  • Development Setup: Deploy the application for local testing and development environment.

For running the application locally for production purposes, refer to the Production Setup.

Development

To deploy both the frontend and backend for local, follow these steps:

Important

We are currently migrating from create-react-app to Nextjs in the frontend, if that's where you want to contribute, please check the following github issue here: #3

Prerequisites

Before you begin, ensure that you have the following prerequisites in place:

  • Node.js v16 or above
Frontend Setup
  1. Clone the project repository:
git clone https://github.com/devarshishimpi/staticstorm
cd staticstorm
  1. Navigate to the frontend directory:
cd frontend
  1. Install dependencies:
npm install
  1. Start the frontend development server:
npm start

The frontend should now be running locally, and you can access it in your web browser at http://localhost:3000.

Backend Setup
  1. Navigate to the server directory in a new terminal window:
cd server
  1. Install backend dependencies:
npm install
  1. Start the backend server:
node index.js

The backend should now be running locally, and you can access it in your web browser at http://localhost:8181.

Production

To deploy both the frontend and backend to proudction, follow these steps:

Prerequisites

Before you begin, ensure that you have the following prerequisites in place:

  • Linux Machine (eg: Ubuntu)
  • Nodejs v16 or above
  • Nginx Server

Once you are done with that you may proceed to deploy the application:

  1. Clone the project repository:
git clone https://github.com/devarshishimpi/staticstorm
cd staticstorm
  1. Navigate to the frontend directory:
cd frontend
  1. Install dependencies:
npm install
  1. Build the frontend:
npm run build
  1. Copy the frontend files to the server's HTML directory:
sudo cp -rf build /var/www/html
  1. Navigate to the server directory:
cd ../server
  1. Install backend dependencies:
npm install
  1. Copy the backend files to the server's HTML directory:
sudo cp -rf . /var/www/html
  1. Edit the Nginx configuration file:
sudo vim /etc/nginx/sites-available/default
  1. Update the Nginx configuration to include both frontend and backend as separate locations:
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html/build;

    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
        try_files $uri $uri/ /index.html;
    }

    location /api/ {
        proxy_pass http://localhost:8181;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    autoindex off;

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires 7d;  # Cache these static assets for 7 days (adjust as needed)
        add_header Cache-Control "public, max-age=604800, immutable";
    }
}
  1. Restart Nginx to apply the configuration changes:
sudo service nginx restart

Note

If you want to use your custom domain name and subdomain, replace the second _ in server_name _; with your domain name and subdomain.

  1. Access Your Application

You can now access your application in a web browser by navigating to http://youripaddress. The frontend will be served from the root, and the backend API will be available at http://youripaddress/api.