Ytsharedify project is a full-stack web application that allows users to share and view videos. The backend is built with Ruby on Rails, and the frontend is built with React and TypeScript. Key features include user authentication, video sharing, and a real-time video list.
- Ruby 3.3.0
- Node.js 20
- PostgreSQL 13
- Redis 6.2
- Docker (optional)
- Clone the repository:
git clone <repository-url>
- Navigate to the project directory:
cd <project-directory>
- Copy the sample environment files for the backend and frontend:
cp backend/.env.sample.erb backend/.env
andcp frontend/.env.sample frontend/.env
- Please review these
.env
files and update the variables as necessary.
- Please review these
- Install backend dependencies:
cd backend && bundle install
- Install frontend dependencies:
cd ../frontend && npm install --legacy-peer-deps
- Install
yt-dlp
:
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp
- Configure Sidekiq:
- Ensure Redis is installed and running:
redis-server
- Start Sidekiq from the backend directory:
bundle exec sidekiq
- Ensure Redis is installed and running:
- Navigate to the backend directory:
cd backend
- Create the database and run migrations:
bundle exec rails db:create db:migrate
- (Optional) Seed the database:
bundle exec rails db:seed
- Start the Rails server: In the backend directory
bundle exec rails server -p 8080
- In a new terminal, navigate to the frontend directory:
cd frontend
- Start the React development server:
npm start
- Access the application in your web browser at
http://localhost:3000
- Run the test suite:
bundle exec rspec
(backend) andnpm test
(frontend)
- Build the Docker images:
docker-compose build
- Run the Docker containers:
docker-compose up
- Access the application in your web browser at
http://localhost:3001
After starting the application, you can register a new account or log in. Once authenticated, you can share videos by providing a URL and view a list of shared videos.
- If you encounter issues with database setup, ensure that PostgreSQL is running and that the
DB_HOST
,DB_USER
, andDB_PASSWORD
environment variables are correctly set in your.env
file. - If the Rails server fails to start, check the [
backend/log/development.log
] file for potential errors. - If the React development server fails to start, ensure that Node.js is correctly installed and that the
REACT_APP_API_URL
,REACT_APP_TOKEN_KEY
, andREACT_APP_CABLE_ENDPOINT
environment variables are correctly set in your.env
file.