--- title: Introduction project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/introduction/ updated: 2026-11-19T07:46:45.185Z --- # Introduction > What Total.js OpenReports is, how views and reports work together and where to start. Total.js OpenReports is a small app for making simple reports from a PostgreSQL database. You describe your data once, then anyone who uses the app builds reports with a few clicks: pick the columns, group them, add filters and sort the result. You can look at the data in the browser, export it to CSV or Excel, or read it from other programs through an API. ## How it works OpenReports has two building blocks: - **Views.** A view is an SQL query plus a list of the columns people may use, with a name and a type for each one. You write views once. See [Create a view](../create-view/). - **Reports.** A report uses one view. It chooses the fields to show, how to group and total them, which rows to keep and how to sort them. See [Create a report](../create-report/). OpenReports only reads the data that your views select. It keeps its own settings, views and reports in one file on the server. ## What to read next 1. Install OpenReports [from source](../install-source/) or [with Docker](../install-docker/). 2. Open the app: [First access](../first-access/). 3. Connect it to your data: [Connect the database](../connect-database/). 4. Describe your data: [Create a view](../create-view/). 5. Build your first report: [Create a report](../create-report/). 6. Before you go live, read [Run in production](../production/) and [Back up OpenReports](../backups/). --- title: Install from source project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/install-source/ updated: 2026-11-19T07:46:45.185Z --- # Install from source > Install OpenReports with Node.js and start it on your computer or server. You need [Node.js](https://nodejs.org) 16 or newer, Git, and a PostgreSQL database that OpenReports can reach. ## Install and start **1.** Get the code and open its folder: ```bash git clone https://github.com/totaljs/openreports.git cd openreports ``` **2.** Install the dependencies (once): ```bash npm install ``` **3.** Start OpenReports: ```bash npm start ``` **4.** Open `http://localhost:8000/` in your browser. See [First access](../first-access/). OpenReports keeps running until you stop it with Ctrl+C in the terminal. ## Use another port `npm start` uses port 8000. To use another port, start OpenReports with Node.js and pass the port: ```bash node index.js 8080 ``` ## Where your work is saved Your settings, views and reports live in the file `databases/memorize_data.json` inside the OpenReports folder. See [Back up OpenReports](../backups/). ## Keep your server safe OpenReports has no sign-in page of its own. Before you install it on a server that others can reach, read [Run in production](../production/). --- title: Install with Docker project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/install-docker/ updated: 2026-11-19T07:46:45.185Z --- # Install with Docker > Build a Docker image of OpenReports from its repository and run it with a volume for your data. The repository has a `Dockerfile`. Build your own image from it, and keep the data folder of the container in a volume so your views and reports survive when the container is replaced. ## Build the image ```bash git clone https://github.com/totaljs/openreports.git cd openreports docker build -t openreports . ``` ## Run the container ```bash docker run -d --name openreports -p 8000:8000 -v openreports-data:/www/.src/databases openreports ``` Open `http://localhost:8000/` and continue with [First access](../first-access/). The volume `openreports-data` holds the file `memorize_data.json` with your settings, views and reports. You can stop, remove and create the container again with the same command, and your work stays. ## Run it with Docker Compose Save this as `compose.yaml` in the `openreports` folder: ```yaml services: web: build: . ports: - "8000:8000" volumes: - data:/www/.src/databases volumes: data: ``` Then start it: ```bash docker compose up -d --build ``` ## Connect to PostgreSQL from the container Inside the container, `localhost` is the container itself. In the connection string, use an address of the PostgreSQL server that the container can reach, for example the name of a PostgreSQL container on the same Docker network. See [Connect the database](../connect-database/). --- title: First access project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/first-access/ updated: 2026-11-19T07:46:44.889Z --- # First access > Open OpenReports for the first time and find your way around the screen. OpenReports has no sign-in page. The app opens at the root address, for example `http://localhost:8000/`, and shows the **Reports** screen. When OpenReports starts, the terminal (or `docker logs openreports` for Docker) prints a short report. Its last line shows the address and port the server listens on. ![The Reports screen with a search box, two reports, and a Sales category with one chart report](/files/JapUXo9Es61f.webp) ## The screen - **The bar on the left** switches between the three parts of the app. Point at an icon to see its name: - **Reports**: your reports. See [Organize reports](../organize-reports/). - **Views**: the data the reports use. See [Create a view](../create-view/). - **Configuration**: the database connection and the other settings. See [Connect the database](../connect-database/). - **The header** shows the name of the screen and its buttons, such as **Create** and **Refresh**. ## First steps A new OpenReports has no database connection, no views and no reports. Set them up in this order: 1. [Connect the database](../connect-database/). 2. [Create a view](../create-view/). 3. [Create a report](../create-report/). --- title: Connect the database project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/connect-database/ updated: 2026-11-19T07:46:42.257Z --- # Connect the database > Enter the PostgreSQL connection string and the name of the app in Configuration. OpenReports reads its data from one PostgreSQL database. You set the connection in **Configuration**. ![The Application panel of Configuration with the Name and the Connection string](/files/JapUXO8qs61f.webp) ## Set the connection 1. Select **Configuration** (the gear icon) in the bar on the left. 2. In **Connection string**, enter the address of your database in this form: `postgres://user:password@host:5432/database`. 3. Select **SUBMIT**. The message **Configuration have been saved successfully.** appears. OpenReports connects with the new settings straight away; you do not need to restart it. The field hides its value after you leave it. ## Name **Name** is the name of the app. It appears as the title of the browser tab. The default is `OpenReports`. ## Use a user that can only read The SQL of every view runs with the user of the connection string. Give OpenReports its own PostgreSQL user that can read your tables but not change them. For example, for a database named `shop`: ```sql CREATE ROLE openreports LOGIN PASSWORD 'choose-a-password'; GRANT CONNECT ON DATABASE shop TO openreports; GRANT USAGE ON SCHEMA public TO openreports; GRANT SELECT ON ALL TABLES IN SCHEMA public TO openreports; ``` Then use `openreports` and its password in the connection string. `GRANT SELECT ON ALL TABLES` covers the tables that exist now; run it again after you add tables. ## Other settings on this screen - **Enable API for reading reports** and **Token**: see [Enable the API](../enable-api/). - **OpenPlatform**: see [Use OpenReports with OpenPlatform](../openplatform/). --- title: Create a view project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/create-view/ updated: 2026-11-19T07:46:43.104Z --- # Create a view > Describe the data your reports can use: an SQL query and a list of fields. A view tells OpenReports which data reports may use. It is a short JSON document with an SQL query and one entry for each column that people can pick. You write it in the **Views** screen. ![The Views screen with one view named Orders](/files/JapUXU8ws61f.webp) ## Create the view 1. Select **Views** (the layers icon) in the bar on the left. 2. Select **Create**. The **View specification** editor opens with an example. 3. Replace the example with your view, then select **SUBMIT**. The view appears as a card in the **Views** screen. It is ready to use in reports. ## An example This view reads a table of orders: ```json { "id": "orders", "name": "Orders", "sql": "SELECT customer, country, product, quantity, total, paid, dtcreated FROM demo_orders", "fields": [ { "column": "customer", "name": "Customer", "type": "string", "group": true }, { "column": "country", "name": "Country", "type": "string", "group": true }, { "column": "product", "name": "Product", "type": "string", "group": true }, { "column": "quantity", "name": "Quantity", "type": "number" }, { "output": "@", "column": "total", "name": "Total", "type": "number", "format": 2 }, { "column": "paid", "name": "Paid", "type": "boolean" }, { "column": "dtcreated", "name": "Created", "type": "date", "group": true } ] } ``` ![The View specification editor with the Orders view](/files/JapUXX8xs60f.webp) - `sql` selects the data. It can join tables, compute columns and use `WHERE`, like any `SELECT`. - Each entry in `fields` names a column of that query, the name people see (`name`) and its type (`type`): `string`, `number`, `boolean` or `date`. - `"group": true` lets reports group rows by this field. Every key is described in [View definition](../../reference/view-definition/). ## Tips - Run the SQL in `psql` or another client first. If the SQL is wrong, the report shows no useful data. - The `id` of each view must be unique. Saving a view with the `id` of another view replaces that view. - People see only the fields you list, even if the query returns more columns. Next: [Create a report](../create-report/). --- title: Edit and remove views project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/edit-views/ updated: 2026-11-19T07:46:43.430Z --- # Edit and remove views > Change the SQL or the fields of a view, or remove a view and its reports. You change and remove views in the **Views** screen. Each view has a gear icon on its card. ## Edit a view 1. In **Views**, select the card of the view, or select its gear icon and then **Edit**. 2. Change the JSON in the **View specification** editor. 3. Select **SUBMIT**. Reports that use the view use the new SQL the next time they run. ## Keep your reports when you change a field Reports remember each field by an ID. Without `output`, the ID comes from `column`. If you change the `column` of a field, its ID changes and reports lose that field from their fields, groups, filters and sorting. To rename a column safely, give the field an `output` first, for example `"output": "total"`. The ID is then `total`, whatever the column is. See [View definition](../../reference/view-definition/). Changing `name`, `type`, `format` or `group` keeps the ID. ## Remove a view 1. Select the gear icon on the card of the view, then **Remove**. 2. Confirm with **Remove**. Removing a view also removes every report that uses it. This cannot be undone, so [back up OpenReports](../backups/) first if you are not sure. --- title: Create a report project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/create-report/ updated: 2026-11-19T07:46:42.567Z --- # Create a report > Create a report: choose its view, name, category, icon and colour, then save it. A report takes the data of one view and shapes it. You create it in the **Reports** screen. ![The top of the report form with Name, View, Private report, Category, Icon and Color](/files/JapUXR8ts60f.webp) ## Create the report 1. Select **Reports** in the bar on the left, then **Create**. The **Create report** form opens. 2. In **Name**, enter a name, for example `Sales by country`. 3. In **View**, choose the view the report reads. 4. Optionally, set the parts below. 5. Select **SUBMIT**. The report appears in the **Reports** screen. Select the report to see its data. See [Browse and export data](../browse-data/). ## The top of the form | Setting | What it does | |---|---| | **Name** | The name on the card and the title of the data window. Required. | | **View** | The view the report reads. Required. | | **Private report** | The report cannot be loaded through the [API](../enable-api/). Its card shows the badge **private**. | | **Category** | Reports with the same category appear together under its name. Type a new category or choose one you used before. | | **Icon** | The icon on the card. The picker has a search box. | | **Color** | The colour of the icon. | ## The rest of the form - **Group**, **Fields** and **Sort** choose what the report shows. See [Fields and sorting](../fields-and-sorting/) and [Group and total](../group-and-total/). - **Filter** chooses which rows to keep. See [Filter rows](../filters/). - **Limit output to** is the largest number of rows. The default is `1000`. - **Enable chart view** adds chart settings. See [Chart settings](../chart-settings/). A report with no fields shows every field of its view. --- title: Fields and sorting project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/fields-and-sorting/ updated: 2026-11-19T07:46:44.232Z --- # Fields and sorting > Choose the columns of a report, sort the rows and limit how many come back. **Fields** sets the columns of the report and their order. **Sort** sets the order of the rows. ![The Group, Filter, Fields and Sort sections of a report](/files/JapUXi98s61f.webp) ## Add fields 1. In the report form, select **Fields:** (the green plus). 2. Choose a field from the list. 3. Repeat for each column you want. The columns appear in the order you add them. To remove a field, select its red bin icon. If a report has no fields, it shows every field of its view. When the report has a group, the list offers only the grouped fields and the number fields. See [Group and total](../group-and-total/). ## Sort the rows 1. Select **Sort:** and choose a field. It is added as **Descending**. 2. To change the direction, select the sort item and choose **Ascending** or **Descending**. You can add more than one sort field. The first one decides first. Sort by fields that are also in **Fields**. ## Limit the rows **Limit output to** is the largest number of rows the report returns. The default is `1000`. Raise it for longer reports. --- title: Group and total project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/group-and-total/ updated: 2026-11-19T07:46:45.185Z --- # Group and total > Group the rows of a report and show the minimum, maximum or sum of number fields. Grouping turns many rows into one row for each value, for example one row per country. Number fields then show a total for each group. ## Group a report 1. In the report form, select **Group:** and choose a field. Only fields with `"group": true` in the [view](../create-view/) appear. 2. Add the same field to **Fields** so that it shows as a column. 3. Add the number fields you want to total. They get the operation **MAX** at first. You can group by more than one field, for example by country and then by product. ## Choose the operation 1. Select a number field in **Fields**. The **Update field** window opens. 2. In **Scalar operation**, choose **MIN**, **MAX** or **SUM**. 3. Select **SUBMIT**. The operation appears next to the field name. ![The Update field window with the scalar operation SUM](/files/JapUXr9Hs60f.webp) | Operation | Result for each group | |---|---| | **MIN** | The smallest value. | | **MAX** | The largest value. | | **SUM** | The sum of all values. | ## Example With the group **Country**, the fields **Country**, **Total** (**SUM**) and **Quantity** (**SUM**), and the sort **Total** **Descending**, the report shows one row per country with the total sales and quantity, the biggest first. ## Filters on totals A filter on a number field that has an operation applies to the total of each group. For example, the filter **Total** `>=` `200` keeps the countries whose sum is 200 or more. See [Filter rows](../filters/). --- title: Filter rows project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/filters/ updated: 2026-11-19T07:46:44.542Z --- # Filter rows > Keep only the rows you need with filters on the fields of the view. Filters choose which rows a report shows. A report can have several filters; a row must match all of them. ![The Update filter window with the filter type Between](/files/JapUXl9Bs60f.webp) ## Add a filter 1. In the report form, select **Filter:** and choose a field. The filter appears with the type `=` and a starting value. 2. Select the filter. The **Update filter** window opens. 3. Choose the **Filter type** and enter the **Value**. 4. Select **SUBMIT**. To remove a filter, select its red bin icon. ## Values - For **Between**, enter two values separated by a semicolon: `value1; value2`. - For **In**, **Not in** and **Multiple search**, enter the values separated by semicolons: `value1; value2; value3`. - For dates, write `yyyy-MM-dd` or `yyyy-MM-dd HH:mm`. **Insert date** adds a date from a calendar. - For yes/no fields, write `true` or `false`. The filter types for each kind of field are listed in [Filter types](../../reference/filter-types/). ## Ask for the value when the report runs Write a variable such as `{Country}` as the value, and OpenReports asks for it each time someone opens the report. See [Dynamic filters](../dynamic-filters/). --- title: Dynamic filters project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/dynamic-filters/ updated: 2026-11-19T07:46:43.430Z --- # Dynamic filters > Let people enter filter values, such as a country or a period, each time they open a report. A dynamic filter has a variable instead of a fixed value. Each time someone opens the report, OpenReports asks for the value. ## Add a dynamic filter 1. [Add a filter](../filters/) to the report and select it. 2. In **Value**, write a label in curly brackets, for example `{Country}`. For **Between**, use two: `{From}; {To}`. 3. Select **SUBMIT**, then **SUBMIT** in the report form. ## Run the report When you select the report, the **Dynamic filter** window lists one line for each variable. ![The Dynamic filter window asking for a country and a period](/files/JapUXa90s61f.webp) 1. Enter a value on each line and press Enter. 2. Select **SUBMIT**. The data window opens with the matching rows. Date variables have a calendar icon and start with the current date and time. For **Between**, they start with the last day: from yesterday to now. Dates are in your local time. The report keeps the variables. The values you enter are used only for that run. ## Through the API The [API](../enable-api/) lists the dynamic filters of each report, and you send their values when you load it. See [Load a report](../../reference/api-load-report/). --- title: Browse and export data project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/browse-data/ updated: 2026-11-19T07:46:41.584Z --- # Browse and export data > Open the data of a report, copy it, or download it as a CSV or Excel file. Each time you open a report, OpenReports runs its query on the database and shows the result in a data window. ![The data window of a grouped report with five rows and the copy and download buttons](/files/JapUXH8ks61f.webp) ## Open the data Select the card of the report in the **Reports** screen. You can also select its gear icon and then **Browse data**. If the report has [dynamic filters](../dynamic-filters/), enter their values first. The title shows the number of rows, for example **Data: 5 records**. Number fields with a `format` in the view show that many decimals. Dates show in the time zone of your browser. ## Copy and download | Button | What you get | |---|---| | **Copy to clipboard** | The rows with a header line, separated by tabs. Paste them into a spreadsheet. | | **Download CSV** | A CSV file named after the report, with a header line. | | **Download XLSX** | An Excel file named after the report. | Select **Close** or the red cross to close the window. --- title: Organize reports project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/organize-reports/ updated: 2026-11-19T07:46:46.348Z --- # Organize reports > Find, group, clone, edit and remove reports in the Reports screen. The **Reports** screen shows a card for each report. Reports without a category come first; the others appear under the name of their category. ![The options menu of a report with Browse data, Show chart, Clone, Edit and Remove](/files/JapUY39Ts60f.webp) ## Find a report Type in **Search** at the top of the screen. The cards that do not match the name hide as you type. **Refresh** loads the list again, for example after someone else added a report. ## The card - Select the card to [browse its data](../browse-data/). - The badge **private** marks a [private report](../create-report/). - The badge **chart** marks a report with [chart settings](../chart-settings/). - The gear icon opens the options menu. ## The options menu | Item | What it does | |---|---| | **Browse data** | Opens the data window. | | **Clone** | Makes a copy named ` (cloned)` and opens it in the **Update report** form. | | **Edit** | Opens the **Update report** form. Select **SUBMIT** to save your changes. | | **Remove** | Removes the report after you confirm with **Remove**. This cannot be undone. | ## Categories A category is free text in the report form. To move a report to another category, edit it and change **Category**. A category disappears when no report uses it. --- title: Chart settings project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/chart-settings/ updated: 2026-11-19T07:46:41.903Z --- # Chart settings > Turn a report into chart data with an X axis, a Y axis and optional series. **Enable chart view** in the report form turns the rows of a report into chart data: one point for each row, with a label (X axis) and a value (Y axis). Programs read this data through the API. ![The Chart settings of a report: X axis Product, Y axis Total with SUM, and an empty Series for](/files/JapUXL8ns60f.webp) ## Set up the chart 1. Edit the report and select **Enable chart view**. 2. In **X axis**, choose the field for the labels, for example **Product**. 3. In **Y axis**, choose the number field for the values, for example **Total SUM**. 4. Optionally, in **Series for**, choose a field to split the data into one series for each of its values, for example **Country**. 5. Select **SUBMIT**. The axes offer the fields of the report, so add them to **Fields** first. A chart usually works best with a [grouped report](../group-and-total/): one bar per product, with the sum of its sales. The card of the report shows the badge **chart**. ## Read the chart data Load the report through the API with `"chart": true`. See [Chart data](../../reference/api-chart/). --- title: Enable the API project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/enable-api/ updated: 2026-11-19T07:46:43.909Z --- # Enable the API > Turn on the API for reading reports and create its token. Other programs can list your reports and load their data over HTTP. The API is off until you turn it on and set a token. ![The API settings in Configuration: Enable API for reading reports, Token, Generate token and Copy link](/files/JapUXf95s60f.webp) ## Turn it on 1. Select **Configuration** in the bar on the left. 2. Select **Enable API for reading reports**. 3. Select **Generate token** to fill **Token** with a long random value, or enter your own. 4. Select **SUBMIT**. **Copy link** copies the address of the API with the token, for example `http://localhost:8000/reports/?token=...`. ## Send the token Send the token with every request, in one of these ways: - the header `x-token`; - the query argument `token`, as in the copied link. Without the right token, or while the API is off, the API answers `401: Unauthorized`. Treat the token like a password: anyone who has it can read every report that is not private. To change it, generate a new one and select **SUBMIT**. Programs that use the old token stop working. ## What you can do - [List reports](../../reference/api-list-reports/) - [Load a report](../../reference/api-load-report/) - [Chart data](../../reference/api-chart/) [Private reports](../create-report/) cannot be loaded through the API. --- title: Use OpenReports with OpenPlatform project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/openplatform/ updated: 2026-11-19T07:46:46.032Z --- # Use OpenReports with OpenPlatform > Add OpenReports to a Total.js OpenPlatform instance, so that its users sign in there. OpenReports can run as an app inside [Total.js OpenPlatform](https://www.totaljs.com/openplatform/). OpenPlatform then signs people in, and OpenReports gets their permissions from it. ![The OpenPlatform part of Configuration with the import link and the two token fields](/files/JapUY09Qs61f.webp) ## Connect the two apps 1. In OpenReports, open **Configuration**. The **OpenPlatform** part shows a link that ends in `/openplatform.json`. Copy it. 2. In OpenPlatform, import the app with that link and copy the request token and the response token it gives you. 3. Back in **Configuration**, enter them in **Request token** and **Response token**, then select **SUBMIT**. As the warning on the screen says, you are logged out when the tokens are saved. From then on, OpenReports answers `401: Unauthorized` when you open its address directly. Open it from OpenPlatform instead. ## Permissions OpenReports offers these permissions to OpenPlatform: | Permission | What it opens | |---|---| | **Reports** | The **Reports** screen. | | **Views** | The **Views** screen. | | **Setup** | The **Configuration** screen. | | **All reports** | Every report, not only the reports the user created. | | One per category | The reports of that category, for example **Sales**. | ## Go back to working without OpenPlatform **1.** Stop OpenReports. **2.** Open `databases/memorize_data.json` and empty the two tokens: ```json "op_reqtoken": "", "op_restoken": "", ``` **3.** Start OpenReports again. It opens without sign-in. --- title: Run in production project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/production/ updated: 2026-11-19T07:46:46.348Z --- # Run in production > Make an OpenReports server safer before other people can reach it. OpenReports has no sign-in of its own: whoever can open its address can read every report, change the views and the database connection. Before you put it on a server, limit who can reach it. ## Listen only on the server itself By default OpenReports listens on every network address of the server. To accept only connections from the same machine, open `index.js` and remove the `//` at the start of this line: ```js // options.ip = '127.0.0.1'; ``` Then put a web server in front of it (next section). ## Use a reverse proxy with HTTPS Run a web server such as Nginx or Caddy in front of OpenReports. Let it handle HTTPS and allow only the people who need the app, for example with a password or a list of addresses. Point it to `http://127.0.0.1:8000`. For sign-in with user accounts, run OpenReports [inside OpenPlatform](../openplatform/). ## Start in release mode `npm start` runs OpenReports in debug mode, which watches the files for changes. On a server, start it in release mode: ```bash node index.js 8000 --release ``` ## Protect your data - Connect with a PostgreSQL user that can only read. See [Connect the database](../connect-database/). - If you [enable the API](../enable-api/), use a generated token and keep it secret. - [Back up OpenReports](../backups/) regularly. --- title: Back up OpenReports project: OpenReports version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/guides/backups/ updated: 2026-11-19T07:46:36.798Z --- # Back up OpenReports > Find the file that holds your settings, views and reports, and back it up or restore it. OpenReports keeps everything it needs in one file: `databases/memorize_data.json`. It holds the settings of **Configuration**, all views and all reports. Your report data stays in PostgreSQL; back that up with your usual PostgreSQL tools. The file contains the connection string with its password and the API token. Keep your copies in a safe place. ## When the file is written OpenReports writes the file about ten seconds after a change. Wait a little after your last change before you stop the app or copy the file. ## Back up Copy the file while OpenReports is running or stopped: ```bash cp databases/memorize_data.json memorize_data.backup.json ``` With [Docker](../install-docker/), the file is in the volume mounted at `/www/.src/databases`: ```bash docker cp openreports:/www/.src/databases/memorize_data.json memorize_data.backup.json ``` ## Restore 1. Stop OpenReports. 2. Copy your backup over `databases/memorize_data.json`. 3. Start OpenReports again. OpenReports reads the file when it starts. --- title: View definition project: OpenReports version: 1.0 section: reference language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/reference/view-definition/ updated: 2026-11-19T07:46:46.798Z --- # View definition > Every key of the JSON that defines a view. A view is a JSON object that you write in the **View specification** editor. See [Create a view](../../guides/create-view/). ## View keys | Key | Required | What it does | |---|---|---| | `id` | Yes | A unique ID, for example `orders`. A view with the same `id` replaces the old one. | | `name` | Yes | The name in the **Views** screen and in the **View** list of reports. | | `sql` | Yes | A PostgreSQL `SELECT` that returns the data. | | `fields` | Yes | The fields people can use, as a list of objects (below). | ## Field keys | Key | Required | What it does | |---|---|---| | `column` | Yes | A column returned by `sql`. | | `name` | Yes | The name people see in reports and column headers. | | `type` | Yes | `string`, `number`, `boolean` or `date`. It decides the [filter types](../filter-types/) and how values show. | | `group` | No | `true` lets reports group by this field. | | `format` | No | For `number` fields: the number of decimals to show, for example `2`. | | `output` | No | The ID of the field in reports and in the API. `"@"` uses the column name. Without it, OpenReports makes an ID from the column, such as `xfu9n6e`. | ## Field IDs Reports and the [API](../api-list-reports/) refer to fields by their ID. Set `output` when you want readable IDs in the API, or when you may rename the column later: the ID then stays the same. See [Edit and remove views](../../guides/edit-views/). ## Example ```json { "id": "orders", "name": "Orders", "sql": "SELECT customer, country, total, dtcreated FROM demo_orders", "fields": [ { "column": "customer", "name": "Customer", "type": "string", "group": true }, { "column": "country", "name": "Country", "type": "string", "group": true }, { "output": "total", "column": "total", "name": "Total", "type": "number", "format": 2 }, { "column": "dtcreated", "name": "Created", "type": "date", "group": true } ] } ``` --- title: Filter types project: OpenReports version: 1.0 section: reference language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/reference/filter-types/ updated: 2026-11-19T07:46:46.798Z --- # Filter types > The filter types for each kind of field and the values they expect. The **Filter type** list depends on the `type` of the field in the [view](../view-definition/). See [Filter rows](../../guides/filters/). ## Text fields (`string`) | Filter type | Keeps rows where the field | Value | |---|---|---| | **Equal** | is exactly the value | `Spain` | | **Not equal** | is not the value | `Spain` | | **Search** | contains the text, ignoring case | `doe` | | **Multiple search** | contains any of the texts, ignoring case | `doe; rossi` | | **In** | is one of the values | `Spain; Italy` | | **Not in** | is none of the values | `Spain; Italy` | ## Numbers and dates (`number`, `date`) | Filter type | Keeps rows where the field | Value | |---|---|---| | **Lower than** | is lower than or equal to the value | `20` | | **Great than** | is greater than or equal to the value | `100` | | **Equal** | is the value | `2` | | **Not equal** | is not the value | `2` | | **Between** | is between the two values, both included | `30; 60` | | **In** | is one of the values | `1; 2` | | **Not in** | is none of the values | `1; 2` | Write dates as `yyyy-MM-dd` or `yyyy-MM-dd HH:mm`, for example `2026-10-01; 2026-10-31`. ## Yes/no fields (`boolean`) | Filter type | Keeps rows where the field | Value | |---|---|---| | **Equal** | is the value | `true` or `false` | | **Not equal** | is not the value | `true` or `false` | ## Variables Any value can be a variable in curly brackets, such as `{Country}` or `{From}; {To}`. See [Dynamic filters](../../guides/dynamic-filters/). --- title: List reports project: OpenReports version: 1.0 section: reference language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/reference/api-list-reports/ updated: 2026-11-19T07:46:46.798Z --- # List reports > GET /reports/ returns the reports with their fields and dynamic filters. Returns every report with its fields, its dynamic filters and its chart settings. [Enable the API](../../guides/enable-api/) first. ## Request ```bash curl -H "x-token: YOUR_TOKEN" http://localhost:8000/reports/ ``` You can also send the token as `?token=YOUR_TOKEN`. ## Response ```json [ { "id": "JapOn71ca61f", "name": "Orders by country and period", "category": "", "filter": [ { "id": "xfu9n6e", "type": "=", "value": "{Country}", "name": "Country", "datatype": "string" }, { "id": "xg41zyw", "type": "between", "value": "{From}; {To}", "name": "Created", "datatype": "date" } ], "fields": [ { "id": "xa0wfry", "name": "Customer", "datatype": "string" }, { "id": "total", "name": "Total", "datatype": "number" } ], "chart": false }, { "id": "JapNSY1c161f", "name": "Sales by product", "category": "Sales", "filter": [], "fields": [ { "id": "x1twuy9b", "name": "Product", "datatype": "string" }, { "id": "total", "type": "sum", "name": "Total", "datatype": "number" } ], "chart": true, "x": "x1twuy9b", "y": "total", "series": "" } ] ``` | Key | Meaning | |---|---| | `id` | The ID of the report. Use it to [load the report](../api-load-report/). | | `name`, `category` | As in the report form. | | `fields` | The fields of the report: `id`, `name`, `datatype` (the type in the view) and `type` (the operation, when there is one). | | `filter` | Only the [dynamic filters](../../guides/dynamic-filters/), whose values you send when you load the report. | | `chart` | `true` if the report has [chart settings](../../guides/chart-settings/). Then `x`, `y` and `series` hold the IDs of the chosen fields. | After you create or change a view, restart OpenReports so that this list shows the fields and filters of the reports that use it. --- title: Load a report project: OpenReports version: 1.0 section: reference language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/reference/api-load-report/ updated: 2026-11-19T07:46:46.798Z --- # Load a report > POST /reports/ runs a report and returns its fields and rows. Runs a report and returns its rows. [Enable the API](../../guides/enable-api/) first. ## Request ```bash curl -X POST -H "x-token: YOUR_TOKEN" -H "Content-Type: application/json" \ -d '{"id":"JapOn71ca61f","filter":[{"id":"xfu9n6e","value":"Italy"},{"id":"xg41zyw","value":"2026-09-01; 2026-12-31"}]}' \ http://localhost:8000/reports/ ``` | Key | Meaning | |---|---| | `id` | The ID of the report, from [List reports](../api-list-reports/). Required. | | `filter` | Values for the dynamic filters: the field `id` and its `value`, always as text. Filters with a fixed value cannot be changed. | | `chart` | `true` returns [chart data](../api-chart/) instead of rows. | ## Response ```json { "fields": [ { "id": "xa0wfry", "name": "Customer", "datatype": "string" }, { "id": "xfu9n6e", "name": "Country", "datatype": "string" }, { "id": "x1twuy9b", "name": "Product", "datatype": "string" }, { "id": "total", "name": "Total", "datatype": "number", "format": 2 }, { "id": "xg41zyw", "name": "Created", "datatype": "date" } ], "rows": [ { "xa0wfry": "Luca Rossi", "xfu9n6e": "Italy", "x1twuy9b": "Notebook", "total": 12.5, "xg41zyw": "2026-10-07T13:30:00.000Z" }, { "xa0wfry": "Luca Rossi", "xfu9n6e": "Italy", "x1twuy9b": "Office chair", "total": 298, "xg41zyw": "2026-10-28T17:25:00.000Z" } ] } ``` - `fields` describes the columns in order. `format` is the number of decimals from the view. - Each row is an object whose keys are the field IDs. - Dates are in UTC. ## Errors | Answer | Reason | |---|---| | `401: Unauthorized` | The API is off or the token is wrong. | | `404: Not Found` | No report has this ID, or the report is private. | --- title: Chart data project: OpenReports version: 1.0 section: reference language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/reference/api-chart/ updated: 2026-11-19T07:46:46.798Z --- # Chart data > POST /reports/ with "chart": true returns the chart data of a report. Returns the data of a report as chart series. The report needs [chart settings](../../guides/chart-settings/). ## Request ```bash curl -X POST -H "x-token: YOUR_TOKEN" -H "Content-Type: application/json" \ -d '{"id":"JapNSY1c161f","chart":true}' \ http://localhost:8000/reports/ ``` You can add `filter` as in [Load a report](../api-load-report/). If the report has no chart settings, you get rows instead. ## Response without series One series, named after the report, with one point for each row: `x` from the X axis field and `y` from the Y axis field. ```json [ { "id": "JapNSY1c161f", "name": "Sales by product", "icon": "ti ti-chart-pie", "color": "#4285F4", "data": [ { "x": "Office chair", "y": 596 }, { "x": "Desk lamp", "y": 209.3 }, { "x": "Monitor stand", "y": 159.6 }, { "x": "Notebook", "y": 97.5 } ] } ] ``` ## Response with series With **Series for**, you get one series for each value of that field. Its `name` is the value. ```json [ { "id": "JapNIj1uE61f_3275293922", "name": "Slovakia", "icon": "", "color": "", "data": [ { "x": "Desk lamp", "y": 89.7 }, { "x": "Notebook", "y": 50 } ] }, { "id": "JapNIj1uE61f_2112320571", "name": "France", "icon": "", "color": "", "data": [ { "x": "Desk lamp", "y": 29.9 }, { "x": "Monitor stand", "y": 39.9 } ] } ] ``` --- title: Reports and data project: OpenReports version: 1.0 section: faq language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/faq/reports/ updated: 2026-11-19T07:46:36.798Z --- # Reports and data > Answers to common questions about views, reports and their data. ## Which databases can I use? PostgreSQL only. OpenReports connects to one database at a time. See [Connect the database](../../guides/connect-database/). ## Why do the times differ from the database? OpenReports reads dates as UTC and the data window shows them in the time zone of your browser. A time stored as `11:00` shows as `13:00` in a browser two hours ahead of UTC. The [API](../../reference/api-load-report/) returns dates in UTC. ## Why does my report stop at 1000 rows? **Limit output to** is `1000` by default. Edit the report and raise it. See [Fields and sorting](../../guides/fields-and-sorting/). ## A field disappeared from my report. Why? The `column` of the field changed in the view, so its ID changed. Add the field to the report again. To avoid it, give fields an `output`. See [Edit and remove views](../../guides/edit-views/). ## Why can I not group by a field? Only fields with `"group": true` in the view appear in **Group**. Edit the view and add it. See [View definition](../../reference/view-definition/). ## The data window shows one empty row. What is wrong? Usually the SQL of the view, for example a column that does not exist. Run the SQL in `psql` to find the error, then [edit the view](../../guides/edit-views/). ## Does OpenReports store my data? No. Each time you open a report, it runs the query on PostgreSQL. It stores only its settings, views and reports. See [Back up OpenReports](../../guides/backups/). --- title: Access and setup project: OpenReports version: 1.0 section: faq language: en license: MIT url: https://totaljs.es/docs/openreports/1-0/faq/access/ updated: 2026-11-19T07:46:36.798Z --- # Access and setup > Answers to common questions about signing in, settings and where things are stored. ## How do I sign in? OpenReports has no sign-in of its own; everyone who opens it can use all of it. Limit who can reach it, or run it inside OpenPlatform. See [Run in production](../../guides/production/) and [Use OpenReports with OpenPlatform](../../guides/openplatform/). ## I saved OpenPlatform tokens and now see "401: Unauthorized". What now? That is expected: OpenReports now opens only from OpenPlatform. To go back, empty the tokens in `databases/memorize_data.json` while the app is stopped. See [Use OpenReports with OpenPlatform](../../guides/openplatform/). ## Where is the connection string stored? In `databases/memorize_data.json`, together with the views and reports. You change it in **Configuration**, not in the `config` file. See [Back up OpenReports](../../guides/backups/). ## How do I change the name in the browser tab? Change **Name** in **Configuration** and select **SUBMIT**. See [Connect the database](../../guides/connect-database/). ## How do I change the port? Pass it when you start OpenReports, for example `node index.js 8080`. With Docker, change the first number of `-p 8000:8000`. See [Install from source](../../guides/install-source/).