Skip to content

Commit dce748e

Browse files
authored
Merge pull request #51 from rommapp/mega-docs-cleanup
Mega docs cleanup
2 parents 47bcf77 + ea2e4e6 commit dce748e

20 files changed

Lines changed: 732 additions & 184 deletions

.github/resources/social-preview.svg

Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# API Reference
2+
3+
RomM provides a comprehensive REST API that allows you to programmatically interact with your RomM instance. Most API endpoints are authenticated and follow RESTful conventions.
4+
5+
## Interactive Documentation
6+
7+
RomM automatically generates interactive API documentation using OpenAPI (Swagger). You can access the interactive API docs directly from your running instance:
8+
9+
- **Swagger UI**: Available at `http://your-instance:3000/api/docs`
10+
- **ReDoc**: Available at `http://your-instance:3000/api/redoc`
11+
12+
These interactive docs allow you to:
13+
14+
- Browse all available endpoints
15+
- View request/response schemas
16+
- Test API calls directly from your browser
17+
- Understand authentication requirements
18+
- Download the OpenAPI specification
19+
20+
## Base URL
21+
22+
The API base URL is typically:
23+
24+
```text
25+
http://your-instance:3000/api
26+
```
27+
28+
Replace `your-instance` with your actual RomM instance URL or IP address.
29+
30+
## Authentication
31+
32+
All API endpoints require authentication. RomM supports:
33+
34+
- **Basic HTTP Authentication** - Username and password
35+
- **OAuth2 Password Bearer** - Token-based authentication (recommended for API usage)
36+
37+
When using OAuth2, you'll need to obtain a token from `/api/token` endpoint and include it in the `Authorization` header as `Bearer <token>`.
38+
39+
### OAuth2 Scopes
40+
41+
The API uses OAuth2 scopes to control access to different resources:
42+
43+
**Read Scopes:**
44+
45+
- `me.read` - View your profile
46+
- `roms.read` - View ROMs
47+
- `platforms.read` - View platforms
48+
- `assets.read` - View assets
49+
- `firmware.read` - View firmware
50+
- `roms.user.read` - View user-rom properties
51+
- `collections.read` - View collections
52+
- `users.read` - View users
53+
54+
**Write Scopes:**
55+
56+
- `me.write` - Modify your profile
57+
- `assets.write` - Modify assets
58+
- `roms.user.write` - Modify user-rom properties
59+
- `collections.write` - Modify collections
60+
- `roms.write` - Modify ROMs
61+
- `platforms.write` - Modify platforms
62+
- `firmware.write` - Modify firmware
63+
- `users.write` - Modify users
64+
- `tasks.run` - Run tasks
65+
66+
## API Endpoints Overview
67+
68+
The RomM API provides comprehensive endpoints for managing all aspects of your ROM collection:
69+
70+
### Core Resources
71+
72+
- **Platforms** - Manage and configure gaming platforms
73+
- **ROMs** - Full CRUD operations for ROM files with extensive filtering, searching, and metadata matching
74+
- **Collections** - Create and manage ROM collections, smart collections, and virtual collections
75+
- **Users** - User management, authentication, invite links, and profiles
76+
77+
### Supporting Features
78+
79+
- **Authentication** - OAuth2 token management, OIDC login, password resets
80+
- **Search** - Metadata provider search for ROMs and covers
81+
- **Tasks** - Background task management and execution
82+
- **Assets** - Save files, states, screenshots management
83+
- **Firmware** - Upload and manage firmware files for emulation
84+
- **Configuration** - System configuration, platform bindings, and exclusions
85+
- **Feeds** - Integration feeds for WebRcade and Tinfoil
86+
- **Statistics** - System statistics and resource tracking
87+
88+
For complete endpoint documentation including request/response schemas, query parameters, and authentication requirements, visit the interactive API documentation at `/api/docs` or `/api/redoc` on your RomM instance.
89+
90+
## Example Usage
91+
92+
### Using cURL
93+
94+
```bash
95+
# Get all libraries
96+
curl -u username:password http://your-instance:3000/api/libraries
97+
98+
# Get a specific ROM
99+
curl -u username:password http://your-instance:3000/api/roms/123
100+
101+
# Create a new ROM entry
102+
curl -X POST -u username:password \
103+
-H "Content-Type: application/json" \
104+
-d '{"name": "New ROM", "platform_id": 1}' \
105+
http://your-instance:3000/api/roms
106+
```
107+
108+
### Using Python
109+
110+
```python
111+
import requests
112+
from requests.auth import HTTPBasicAuth
113+
114+
# Setup authentication
115+
auth = HTTPBasicAuth('username', 'password')
116+
base_url = 'http://your-instance:3000/api'
117+
118+
# Get all libraries
119+
response = requests.get(f'{base_url}/libraries', auth=auth)
120+
libraries = response.json()
121+
122+
# Get a specific ROM
123+
response = requests.get(f'{base_url}/roms/123', auth=auth)
124+
rom = response.json()
125+
```
126+
127+
### Using JavaScript/Node.js
128+
129+
```javascript
130+
const axios = require("axios");
131+
132+
// Setup authentication
133+
const api = axios.create({
134+
baseURL: "http://your-instance:3000/api",
135+
auth: {
136+
username: "username",
137+
password: "password",
138+
},
139+
});
140+
141+
// Get all libraries
142+
const libraries = await api.get("/libraries");
143+
144+
// Get a specific ROM
145+
const rom = await api.get("/roms/123");
146+
```
147+
148+
## OpenAPI Specification
149+
150+
You can download the complete OpenAPI specification from your RomM instance:
151+
152+
```text
153+
http://your-instance:3000/api/openapi.json
154+
```
155+
156+
This specification can be imported into API testing tools like Postman, used to generate client libraries, or used for API mocking.
157+
158+
## Getting Help
159+
160+
For API-specific questions or issues:
161+
162+
1. Check the interactive documentation at `/api/docs` or `/api/redoc` on your instance
163+
2. Review the code in the [RomM repository](https://github.com/rommapp/romm)
164+
3. Open an issue on [GitHub](https://github.com/rommapp/romm/issues)
165+
4. Join the [Discord community](https://discord.com/invite/romm)
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Contributing to RomM
2+
3+
Thank you for considering contributing to RomM! This document outlines some guidelines to help you get started with your contributions.
4+
5+
**If you're looking to implement a large feature or make significant changes to the project, it's best to open an issue first AND join the Discord to discuss your ideas with the maintainers.**
6+
7+
## Code of Conduct
8+
9+
Please note that this project adheres to the Contributor Covenant [code of conduct](CODE_OF_CONDUCT.md). By participating in this project, you are expected to uphold this code.
10+
11+
## AI Assistance Notice
12+
13+
> [!IMPORTANT]
14+
>
15+
> If you are using **any kind of AI assistance** to contribute to RomM, it must be disclosed in the pull request.
16+
17+
If you are using any kind of AI assistance while contributing to RomM **this must be disclosed in the pull request**, along with the extent to which AI assistance was used (e.g. docs only vs. code generation). If PR responses are being generated by an AI, disclose that as well. As a small exception, trivial tab-completion doesn't need to be disclosed.
18+
19+
An example disclosure:
20+
21+
> This PR was written primarily by Claude Code.
22+
23+
Or a more detailed disclosure:
24+
25+
> I consulted ChatGPT to understand the codebase but the solution
26+
> was fully authored manually by myself.
27+
28+
Failure to disclose this is rude to the human operators on the other end of the pull request, but it also makes it difficult to determine how much scrutiny to apply to the contribution.
29+
30+
In a perfect world, AI assistance would produce equal or higher quality work than any human. That isn't the world we live in today, and in most cases it's generating slop.
31+
32+
Please be respectful to maintainers and disclose AI assistance.
33+
34+
## Contributing to the Docs
35+
36+
If you would like to contribute to the project's [documentation](https://docs.romm.app), open a pull request against [the docs repo](https://github.com/rommapp/docs). We welcome any contributions that help improve the documentation (new pages, updates, or corrections).
37+
38+
## Adding Translations
39+
40+
If you would like to translate the project into another language, create a new folder under the `frontend/src/locales` directory, and follow the existing language files as a template. Once you've created the new language file, open a pull request to add it to the project.
41+
42+
## How to Contribute Code
43+
44+
1. Fork the repository.
45+
2. Clone your forked repository: `git clone https://github.com/your-username/romm.git`
46+
3. Checkout the `master` branch: `git checkout master`
47+
4. Follow the steps in the [developer setup guide](DEVELOPER_SETUP.md)
48+
5. Create a new branch for your feature/fix: `git checkout -b feature-or-fix-name`
49+
6. Make your changes and commit them with descriptive commit messages: `git commit -am 'Add feature XYZ'`
50+
7. Push your changes to your fork: `git push origin feature-or-fix-name`
51+
8. Open a pull request to the `master` branch of the original repository.
52+
53+
## Pull Request Guidelines
54+
55+
- Make sure your code follows the project's coding standards.
56+
- Test your changes locally before opening a pull request.
57+
- Update the documentation if necessary.
58+
- Ensure all existing tests pass, and add new tests for new functionality.
59+
- Use clear and descriptive titles and descriptions for your pull requests.
60+
61+
## Code Style
62+
63+
Follow the existing code style used throughout the project. If working with VSCode or a similar editor, consider installing these extensions:
64+
65+
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
66+
- [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
67+
- [Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance)
68+
- [Ruff](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff)
69+
- [Vue - Official](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
70+
71+
## Issue Reporting
72+
73+
If you encounter any bugs or have suggestions for improvements, please [create an issue](https://github.com/rommapp/romm/issues) on GitHub. Provide as much detail as possible, including steps to reproduce the issue if applicable.
74+
75+
## Licensing
76+
77+
By contributing to RomM, you agree that your contributions will be licensed under the project's [LICENSE](LICENSE).
78+
79+
---
80+
81+
Thank you for contributing to RomM! Your help is greatly appreciated.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Setting up RomM for development
2+
3+
Docker provides a quick and easy way to get started with RomM by encapsulating all dependencies within Docker containers. This guide will walk you through the process of setting up RomM for development using Docker.
4+
5+
## Environment setup
6+
7+
### Create the mock structure with at least one rom and empty config for manual testing
8+
9+
```sh
10+
mkdir -p romm_mock/library/roms/switch
11+
touch romm_mock/library/roms/switch/metroid.xci
12+
mkdir -p romm_mock/resources
13+
mkdir -p romm_mock/assets
14+
mkdir -p romm_mock/config
15+
touch romm_mock/config/config.yml
16+
```
17+
18+
### Copy env.template to .env and fill the variables
19+
20+
```sh
21+
cp env.template .env
22+
```
23+
24+
```dotenv
25+
ROMM_BASE_PATH=/app/romm
26+
DEV_MODE=true
27+
```
28+
29+
### Build the image
30+
31+
```sh
32+
docker compose build # or `docker compose build --no-cache` to rebuild from scratch
33+
```
34+
35+
### Spin up the Docker containers
36+
37+
```sh
38+
docker compose up -d
39+
```
40+
41+
And you're done! You can access the app at `http://localhost:3000`. Any changes made to the code will be automatically reflected in the app thanks to the volume mounts.

docs/API-and-Development/index.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
search:
3+
exclude: true
4+
---
5+
6+
# API & Development
7+
8+
Welcome to the RomM API & Development documentation. This section contains resources for developers looking to interact with RomM programmatically or contribute to its development.
9+
10+
## Contents
11+
12+
- **[API Reference](API-Reference.md)** - Complete API documentation with endpoints, schemas, and examples
13+
- **[Contributing](Contributing.md)** - Guidelines for contributing code, translations, and documentation
14+
- **[Development Setup](Development-Setup.md)** - How to set up your development environment

docs/Getting-Started/Authentication.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ You'll want to set the following environment variable before starting RomM:
1010

1111
### Sessions
1212

13-
When the `/login` endpoint is called with valid credentials, a `session_id` is generated, stored as a cookie and sent to the browser. The same token is used to create a cache entry in Redis (or in-memory if Redis is disabled) which maps the token to the user. This way no sensitive information is stored on the client.
13+
When the `/login` endpoint is called with valid credentials, a `session_id` is generated, stored as a cookie and sent to the browser. The same token is used to create a cache entry in Valkey (or in-memory if Valkey is disabled) which maps the token to the user. This way no sensitive information is stored on the client.
1414

1515
### Roles
1616

0 commit comments

Comments
 (0)