Skip to content

Feature/instsallationscript#144

Open
sagar-18-07-2006 wants to merge 3 commits into
rushikesh-bobade:mainfrom
sagar-18-07-2006:feature/instsallationscript
Open

Feature/instsallationscript#144
sagar-18-07-2006 wants to merge 3 commits into
rushikesh-bobade:mainfrom
sagar-18-07-2006:feature/instsallationscript

Conversation

@sagar-18-07-2006

Copy link
Copy Markdown

Description

This PR introduces an interactive cross-platform development setup wizard that automates the initial project configuration process for contributors.

What's included

  • Added an interactive CLI setup script (setup.js) for Windows, macOS, and Linux.
  • Validates the development environment before setup (Node.js version, required project files, installed dependencies).
  • Automatically creates a .env file from .env.example when needed.
  • Supports both Docker and Supabase as database setup options.
  • Detects whether Docker is installed and running, with platform-specific guidance if it is unavailable.
  • Automatically configures environment variables based on the selected database option.
  • Starts the PostgreSQL container (Docker), waits for it to become ready, and initializes the database.
  • Runs Prisma setup (db push and generate) automatically.
  • Provides clear error messages with troubleshooting steps for common setup failures.
  • Optionally starts the development server after setup completes.

This significantly reduces the manual steps required for new contributors and provides a consistent onboarding experience across supported operating systems.


Related Issues

Fixes #136


Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Screenshots (if applicable)

N/A – This feature is a command-line interactive setup wizard. A terminal recording or screenshots of the setup flow can be added if required by the reviewers.

sagar-18-07-2006 and others added 2 commits July 10, 2026 18:04
- Add Node.js version check (18+ required) with upgrade instructions
- Enhance Prisma error handling with specific guidance for common failures
  - ECONNREFUSED: Docker/Supabase connection troubleshooting
  - Authentication failures: ENV variable verification
  - Database missing: Docker cleanup and reinitialize steps
- Add platform-specific Docker installation guidance
  - Windows: WSL 2 recommendation
  - macOS: Docker Desktop specifics
  - Linux: systemctl daemon setup
- Improve .env.example reference in setup flow
- Update wizard banner to show environment verification step

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
Register npm run setup command for the FlipTrack setup wizard.

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

@sagar-18-07-2006 is attempting to deploy a commit to the participationcorner2025-8967's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the ECSoC26 Required label for ECSOC Sentinel scoring label Jul 10, 2026
@github-actions

Copy link
Copy Markdown

📝 Summary

The provided pull request diff introduces a new setup script for the FlipTrack project, which guides users through setting up their environment, configuring Docker or Supabase, and initializing the database and Prisma. The script is written in JavaScript and utilizes Node.js and various command-line tools to automate the setup process.

📂 Files Changed

  • package.json: Added a new script "setup" that runs the scripts/setup.js file.
  • scripts/setup.js: A new file containing the setup script.

🎭 Code Poem

Setup script so fine and bright,
Guides users through the setup night,
Configures Docker or Supabase with care,
And initializes the database with flair.

🚨 Bugs & Architectural Violations The provided code does not seem to introduce any critical architectural violations or bugs. However, it's worth noting that: * The script assumes that the `docker-compose.yml` file exists in the project root, which might not be the case. * The script uses `spawnSync` to run commands, which can be blocking and might not be suitable for all environments. * The script does not handle errors well, and some error messages might not be very informative. * The script uses `console.clear()` which might not work as expected in all environments. Looks solid in terms of architectural rules, but some improvements can be made for better error handling and flexibility.
💡 Suggestions & Best Practices Some suggestions for improving the code: * Consider using a more robust way to handle errors, such as using a dedicated error handling library or implementing a custom error handling mechanism. * Instead of using `spawnSync`, consider using `spawn` or a library like `child_process` to run commands asynchronously. * Add more informative error messages to help users diagnose issues. * Consider adding more checks to ensure that the `docker-compose.yml` file exists and is valid before attempting to use it. * Instead of using `console.clear()`, consider using a more robust way to clear the console, such as using a library like `clear-console`. * Consider adding more comments and documentation to the code to make it easier to understand and maintain. * Consider breaking down the long `main` function into smaller, more manageable functions.

- Add constants for configuration values (required files, container names)
- Implement clearConsole() with fallback for environments where console.clear() fails
- Extract startDockerCompose() to handle multiple Docker startup strategies
- Add validateDockerPrerequisites() for early validation of docker-compose.yml
- Refactor main() to extract getDatabaseChoice() for better readability
- Extract displayFinalMessage() as a separate function
- Improve error handling in waitForContainerHealth() with try-catch
- Extract sleep() helper to reduce code duplication
- Use choice mapping for clearer database selection logic
- Update error messages for better user guidance

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

📝 Summary

The provided pull request diff introduces a new setup script for the FlipTrack project, which guides users through setting up their environment, configuring Docker or Supabase, and initializing the database. The script is written in JavaScript and utilizes Node.js and Prisma.

📂 Files Changed

  • package.json: Added a new script "setup" that runs the scripts/setup.js file.
  • scripts/setup.js: A new file containing the setup script for the FlipTrack project.

🎭 Code Poem

Code so fine, setup so neat,
Guides the user through each step to repeat,
Docker or Supabase, the choice is clear,
FlipTrack setup, now crystal clear.

🚨 Bugs & Architectural Violations The provided code does not seem to introduce any critical architectural violations or bugs. However, it's essential to note that: * The script uses `spawnSync` which can be a performance bottleneck for large inputs. * The script does not handle errors well in some cases, which could lead to unexpected behavior. * The script assumes that the user has the necessary dependencies installed, which might not always be the case. * There are no UI components introduced in this pull request, so we cannot verify if they are placed in the correct directory. * The script does not seem to use any CSS animations or loaders, so we cannot verify if they are optimized for performance. * The script does not seem to introduce any accessibility issues, but it's essential to verify this in the future when UI components are introduced. Looks solid!
💡 Suggestions & Best Practices * Consider using `spawn` instead of `spawnSync` for better performance. * Improve error handling to provide more informative error messages and to handle unexpected errors. * Add checks to ensure that the necessary dependencies are installed before proceeding with the setup. * Consider adding a check to verify that the UI components are placed in the correct directory. * When introducing UI components in the future, ensure that they are optimized for performance and accessibility. * Consider adding more comments to the code to explain the purpose of each section and to make it easier to understand. * Consider breaking down the long `setup.js` file into smaller, more manageable files.

@sagar-18-07-2006

Copy link
Copy Markdown
Author

not required for our project

@sagar-18-07-2006

Copy link
Copy Markdown
Author

sir what's the issue please think and tell me why it is not merged till yet

@sagar-18-07-2006

Copy link
Copy Markdown
Author

Answer for the review of bot

  • Replaced spawn with spawnSync for synchronous execution of the CLI command.
  • Ensures the child process completes before the script proceeds to the next step.
  • Prevents timing issues where subsequent operations may execute before the spawned process finishes.
  • Simplifies the CLI workflow by removing the need for asynchronous event listeners (close, exit, etc.).
  • Provides more predictable and deterministic behavior for short-lived CLI commands.
  • Improves error handling by making the process exit status and output immediately available after execution.
  • Since this is a CLI utility where commands are executed sequentially, the blocking behavior of spawnSync is appropriate and has minimal impact on overall performance.

@rushikesh-bobade

Copy link
Copy Markdown
Owner

Hey @sagar-18-07-2006, sorry for the delay in reviewing this! I appreciate your patience.

I just went through all 751 lines of setup.js line by line. The overall structure is really well organized. The cross-platform handling (Windows where vs Unix which, .cmd suffixes for npm/npx), the Docker health check retry loop, and the graceful fallback to Supabase when Docker isn't available all show you clearly understand the problem space. Nice work.

Before we can merge, there are a couple of things that need to be fixed:

1. Missing VITE_ Environment Variables (Critical)
In your configureSupabaseEnv() function, you correctly write NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY, but you are missing the VITE_ prefixed versions. If you look at our .env.example, we also require VITE_NEXT_PUBLIC_SUPABASE_URL and VITE_NEXT_PUBLIC_SUPABASE_ANON_KEY. These are required for client-side OAuth and Auth flows. Without them, any contributor who sets up using your script will have a completely broken login page.

Please update configureSupabaseEnv() to also write the VITE_ prefixed variables with the same values the user enters.

2. Missing GROQ_API_KEY Prompt
The original issue description specifically listed "Groq API Key" as one of the required interactive prompts, but your script skips it entirely. Please add a prompt for GROQ_API_KEY in the setup flow (it's needed regardless of the database choice, since AI Insights uses it independently).

3. A Quick Note on AI Tooling
I noticed two of your three commits have Co-authored-by: claude in them. While using AI tools for learning and reference is totally fine, we expect contributors to understand and fully own every line of code they submit. For future PRs, please make sure the code is written by you with AI used only as a learning aid, not as a code generator.

4. A Quick Note on Communication
As an open source project, we review PRs as quickly as we can, but maintainers are volunteers with limited bandwidth. A simple "Hi, just checking in on the review status when you get a chance" always works great. No hard feelings at all, just a heads-up that will serve you well across any open source project you contribute to!

Fix items 1 and 2, and this is ready to merge. You're almost there!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ECSoC26 Required label for ECSOC Sentinel scoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Interactive Cross-Platform Development Setup Scripts

2 participants