A minimalistic table reservation system built with Svelte and SvelteKit. This app allows users to reserve seats at tables in a simple, trust-based environment—ideal for small groups or events where authentication isn't needed.
Note: Cross-origin request checks are currently disabled for easier development and usage across environments.
git clone https://github.com/W4hr/simple-table-reservation.git
cd simple-table-reservation
npm install
The maintainer must define the table/seat structure manually.
In seat.js
, edit the list to reflect your table and seat layout.
[4, 6, 2]
creates 3 tables with 4, 6, and 2 seats respectivelyThen run:
node seat.js
Create a .env
file in the project root and add the following line:
NODE_ENV=development
This ensures the app runs in development mode when using node
.
npm run dev
Then open http://localhost:5173 in your browser.
You can also deploy the app using Docker:
Build the Docker image:
docker build -t simple-table-reservation .
Run the container with your desired table configuration:
docker run -p 3000:3000 \
-e TABLE_LIST='[6,8,4,10]' \
-v /path/to/your/database.db:/app/data/database.db \
simple-table-reservation
This example sets up four tables with 6, 8, 4, and 10 seats respectively.
To start with a fresh database, simply omit the volume flag:
docker run -p 3000:3000 -e TABLE_LIST='[6,8,4,10]' simple-table-reservation
Access the app at http://localhost:3000.
Note: The
TABLE_LIST
environment variable should be a JSON array representing your table layout.
The adminTasks.js
script provides command-line tools for managing the reservation system's database directly. These tasks are useful for administrative actions like clearing reservations or adjusting table setups without interacting with the UI or re-initializing the entire database.
Base Command:
node ./src/lib/adminTasks.js <functionName> [arguments...]
If no function name is provided or if the function name is not recognized, the script will display a list of available functions.
Available Functions:
unreserveSeat <seat_id>
: Clears the reservation for a specific seat.node ./src/lib/adminTasks.js unreserveSeat 15
unreserveSeats
: Clears all reservations from all seats.node ./src/lib/adminTasks.js unreserveSeats
unreserveName <name>
: Clears all reservations made under a specific name.node ./src/lib/adminTasks.js unreserveName "John Doe"
addTable <seat_count>
: Adds a new table with the specified number of seats. Seats will have a default color of "gray".node ./src/lib/adminTasks.js addTable 8
deleteTable <table_id>
: Deletes a table and all its associated seats.node ./src/lib/adminTasks.js deleteTable 3
deleteSeat <seat_id>
: Deletes a specific seat.node ./src/lib/adminTasks.js deleteSeat 216
clearTables
: Deletes all seats and all tables from the database. Use with caution as this will empty your entire seating arrangement.node ./src/lib/adminTasks.js clearTables
Example Usage:
To delete seat with ID 216:
node ./src/lib/adminTasks.js deleteSeat 216
To unreserve all seats currently reserved by "Jane Doe":
node ./src/lib/adminTasks.js unreserveName "Jane Doe"
đź’ˇ Running admin tasks inside Docker:
You can execute adminTasks.js inside the running container using Docker exec:
docker exec -it <container_name_or_id> node adminTasks.js <functionName> [arguments...]
For example, to unreserve seat with ID 216
:
docker exec -it <container_name_or_id> node adminTasks.js unreserveSeat 216
This project is licensed under the MIT License.