Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: spliit-app/spliit
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.6.0
Choose a base ref
...
head repository: spliit-app/spliit
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Apr 13, 2024

  1. Copy the full SHA
    1ad4703 View commit details
  2. Show the impact of an expense on the active user's balance (#139)

    * Add devcontainer configuration for codespace support
    
    * Show the impact of an expense on the active user's balance
    
    * Run prettier
    
    * Put the balance on a different line
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    dcbr and scastiel authored Apr 13, 2024
    Copy the full SHA
    1cd2b27 View commit details

Commits on May 30, 2024

  1. Copy the full SHA
    833237b View commit details
  2. Implement "infinite scroll" for expenses (#95)

    * Extract ExpenseCard vom ExpenseList
    
    * Implement simple pagination of expenses (see #30)
    
    - display only this year's entries by default
    - a "Show more" button reveals all expenses
    
    * Turn getPrisma() into constant "prisma"
    
    - getPrisma() is not async and doesn't need to be awaited
    - turn getPrisma() into exported constant "prisma"
    
    * Select fields to be returned by getGroupExpenses()
    
    - make JSON more concise and less redundant
    - some properties were removed (i.e.instead of "expense.paidById" use "expense.paidBy.id")
    
    * Remove "participants" from ExpenseCard
    
    - no need to search for participant by id to get it's name
    - name property is already present in expense
    
    * Add option to fetch a slice of group expenses
    
    - specify offset and length to get expenses for [offset, offset+length[
    - add function to get total number of group expenses
    
    * Add api route for client to fetch group expenses
    
    * Remove "Show more" button from expense list
    
    * Implement infinite scroll
    
    - in server component Page
      - only load first 200 expenses max
      - pass preloaded expenses and total count
    
    - in client component ExpenseList, if there are more expenses to show
      - test if there are more expenses
      - append preloading "skeletons" to end of list
      - fetch more expenses when last item in list comes into view
      - after each fetch increase fetch-length by factor 1.5
        - rationale: db fetch usually is not the issue here, the longer the list gets, the longer react needs to redraw
    
    * Use server action instead of api endpoint
    
    * Fixes
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    shynst and scastiel authored May 30, 2024
    Copy the full SHA
    d3fd802 View commit details
  3. Fix relative path docker db script (#154)

    Without this, docker complained:
    ```
    docker: Error response from daemon: create ./postgres-data: "./postgres-data" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
    ```
    
    Followed recommendation from https://stackoverflow.com/questions/46526165/docker-invalid-characters-for-volume-when-using-relative-paths
    araffin authored May 30, 2024
    Copy the full SHA
    74465c0 View commit details
  4. change onClick to onFocus, with a slight delay for safari (#144)

    * change onClick to onFocus, with a slight delay for safari
    
    * typo
    
    * fix variable name
    
    * Fix style
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    justcallmelarry and scastiel authored May 30, 2024
    Copy the full SHA
    f9d9153 View commit details
  5. Copy the full SHA
    10e13d1 View commit details
  6. Add basic activity log (#141)

    * Add basic activity log
    
    * Add database migration
    
    * Fix layout
    
    * Fix types
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    dcbr and scastiel authored May 30, 2024
    Copy the full SHA
    e619c1a View commit details
  7. Use placeholder for new participant input (#153)

    * use placeholder for new participant
    
    * Fix formatting
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    owiber and scastiel authored May 30, 2024
    Copy the full SHA
    3887efd View commit details
  8. Add support for group income (= negative expenses) (#158)

    * Allow negative amount for expenses to be entered
    
    - an expense becomes an income
    - this does not affect calculations, i.e. an income can be split just like an expense
    
    * Incomes should not be reimbursements
    
    when entering a negative number
    - deselect 'isReimbursement'
    - hide reimbursement checkbox
    
    * Change captions when entering a negative number
    
    - "expense" becomes "income"
    - "paid" becomes "received"
    
    * Format incomes on expense list
    
    - replace "paid by" with "received by"
    
    * Format incomes on "Stats" tab
    
    - a group's or participants balance might be negative
    - in this case "spendings" will be "earnings" (display accordingly)
    - always display positive numbers
    - for active user: highlight spendings/earnings in red/green
    
    * Fix typo
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    shynst and scastiel authored May 30, 2024
    Copy the full SHA
    0c05499 View commit details
  9. Copy the full SHA
    e990e00 View commit details

Commits on Aug 2, 2024

  1. Increase fuzzines of search results (#187)

    * Introduce normalizeString fn
    
    * Prettier
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    sbehrends and scastiel authored Aug 2, 2024
    Copy the full SHA
    7145cb6 View commit details
  2. Copy the full SHA
    853f179 View commit details
  3. Copy the full SHA
    9b8f716 View commit details
  4. Make recalculation stable across repayments in suggested reimbursemen…

    …ts (#179)
    
    * suggested reimbursements: make recalculation stable across repayments
    
    Previously, after a group participant executed a suggested reimbursement, rerunning getSuggestedReimbursements() could return a completely new list of suggestions.
    
    With this change, getSuggestedReimbursements() should now be stable:
    if it returns a graph with n edges, and then a repayment is made according to one of those edges, when called again, it should now return the same graph but with that one edge removed.
    
    The trick is that the main logic in getSuggestedReimbursements() does not rely on balancesArray being sorted based on .total values, only that the array gets partitioned into participants with credit first and then participants with debt last. After a repayment is made, re-sorting based on .total values would result in a new order hence new suggestions, but sorting based on usernames/participantIds should be unaffected.
    
    fixes #178
    
    * Prettier
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    laszlomakk and scastiel authored Aug 2, 2024
    Copy the full SHA
    002e867 View commit details
  5. feat: add auto-balancing for the amount edit (#173)

    * feat: add auto-balancing for the amount edit
    
    this implementation allocates the rest of the total
    to participants, whose rows have yet not been edited.
    
    * fix: reset already edited on total amount change
    mpjk authored Aug 2, 2024
    Copy the full SHA
    c392c06 View commit details
  6. Internationalization + Finnish language (#181)

    * I18n with next-intl
    
    * package-lock
    
    * Finnish translations
    
    * Development fix
    
    * Use locale for positioning currency symbol
    
    * Translations: Expenses.ActiveUserModal
    
    * Translations: group 404
    
    * Better translation for ExpenseCard
    
    * Apply translations in CategorySelect search
    
    * Fix for Finnish translation
    
    * Translations for ExpenseDocumentsInput
    
    * Translations for CreateFromReceipt
    
    * Fix for Finnish translation
    
    * Translations for schema errors
    
    * Fix for Finnish translation
    
    * Fixes for Finnish translations
    
    * Prettier
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    iqqmuT and scastiel authored Aug 2, 2024
    Copy the full SHA
    4f5e124 View commit details
  7. add group information field to group settings and Information tab (#164)

    * add group information field to group and Information tab to display
    
    * add breaks to info page
    
    * Improve UX
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    ChristopherJohnston and scastiel authored Aug 2, 2024
    Copy the full SHA
    972bb9d View commit details
  8. Update Next.js + Npm audit fix (#190)

    * Audit fix
    
    * Upade Next
    scastiel authored Aug 2, 2024
    Copy the full SHA
    26bed11 View commit details
  9. Copy the full SHA
    5dfe03b View commit details

Commits on Sep 28, 2024

  1. Add French translation (#196)

    * Added french version and title/description from json messages
    
    * Revert back default language to en-US
    
    * Code reviewed with prettier :)
    
    * Updated json to add information field
    
    * Updated json to add information block (missed on previous)
    
    * Reviewed code language
    
    * correction traduction "groupes étoilés" en "groupes favoris"
    
    ---------
    
    Co-authored-by: Andy Trouvé <andy@strekol.eu>
    Strekol and Andy Trouvé authored Sep 28, 2024
    Copy the full SHA
    07e24f7 View commit details
  2. Fix translation

    scastiel committed Sep 28, 2024
    Copy the full SHA
    5fff8da View commit details
  3. feature: add Spanish language support (#214)

    * create ES i18n json
    
    * add ES locale to i18n and existing locales
    
    * capitalize words at es.json
    
    * Add missing translation
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    PauSansa and scastiel authored Sep 28, 2024
    Copy the full SHA
    345f371 View commit details
  4. feat: add German language support (#207)

    * feat: add German language support
    
    * fix: translate other locale names to German
    
    * chore: integrate recommendations from the PR review
    
    * i18n: add translation recommendations from the PR
    
    * Fix translations
    
    ---------
    
    Co-authored-by: Christian Schuller <christianschuller.biz@gmail.com>
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    3 people authored Sep 28, 2024
    Copy the full SHA
    5046314 View commit details
  5. Add Chinese translation (#215)

    * Added Chinese translation
    
    * Add home page translation
    
    * Fix translations
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    kressety and scastiel authored Sep 28, 2024
    Copy the full SHA
    8f896f7 View commit details
  6. Copy the full SHA
    e8d46cd View commit details
  7. Fix: Correctly display loaded expense (#210)

    * Fix #209: Correctly display loaded expense
    
    - Don't load default split options after displaying an existing expense
    - Re-validate form after changing the "paidFor" selection.
      This fixes the error message "The expense must be paid for at least one
      participant." after clicking "Select None" and the selecting one participant.
    
    * Fix Paid For Field reset in Edit Expense Page for split Mode 'Unevenly - By amount'
    
    ---------
    
    Co-authored-by: partho.kunda <partho.kunda@chaldal.net>
    tobiasge and parthokunda authored Sep 28, 2024
    Copy the full SHA
    50b3a2e View commit details
  8. Fix amount preview for scanned receipts (#227)

    * no division of amount
    
    * use gpt-4-turbo
    
    * testing setup and naive test
    
    * test multiple variants
    
    * document
    
    * correct locale names
    
    * test large amounts
    
    * test wth strings
    
    * prettier
    mertd authored Sep 28, 2024
    Copy the full SHA
    9a5674e View commit details
  9. Copy the full SHA
    8eea062 View commit details

Commits on Sep 29, 2024

  1. Fix format for integer amounts (#231)

    * support both fractions and integer values
    
    * test fractions
    
    * prettier
    mertd authored Sep 29, 2024
    Copy the full SHA
    8742bd5 View commit details

Commits on Oct 5, 2024

  1. Added Italian language (#233)

    * Update i18n.ts
    
    * Update de-DE.json
    
    * Update en-US.json
    
    * Update es.json
    
    * Update fi.json
    
    * Update fr-FR.json
    
    * Update ru-RU.json
    
    * Update zh-CN.json
    
    * Create it-IT.json
    
    * Update it-IT.json
    
    * Update it-IT.json
    
    * Update it-IT.json
    
    * Update it-IT.json
    
    * Update it-IT.json
    
    * Prettier
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    Maxco10 and scastiel authored Oct 5, 2024
    Copy the full SHA
    343363d View commit details

Commits on Oct 11, 2024

  1. Update it-IT.json (#237)

    Maxco10 authored Oct 11, 2024
    Copy the full SHA
    24053ca View commit details
  2. add ua-UA (#241)

    ahtutejlo authored Oct 11, 2024
    Copy the full SHA
    1e4edf7 View commit details

Commits on Oct 14, 2024

  1. fix Dockerfile (#206)

    Co-authored-by: samuel <samuel@t460.localdomain>
    bitgroestl and samuel authored Oct 14, 2024
    Copy the full SHA
    a7c80f6 View commit details
  2. Copy the full SHA
    7add7ef View commit details
  3. [translation] Add Polish language (#243)

    * Add polish translation file
    
    * Add polish to other translations
    pktiuk authored Oct 14, 2024
    Copy the full SHA
    727803e View commit details

Commits on Oct 19, 2024

  1. Add tRPC, use it for group expenses, balances and information page (#246

    )
    
    * Add tRPC, use it for group expense list
    
    * Use tRPC for balances
    
    * Use tRPC in group information + better loading states
    scastiel authored Oct 19, 2024
    Copy the full SHA
    66e15e4 View commit details

Commits on Oct 20, 2024

  1. Use tRPC in other group pages (#249)

    * Use tRPC in group edition + group layout
    
    * Use tRPC in group modals
    
    * Use tRPC in group stats
    
    * Use tRPC in group activity
    scastiel authored Oct 20, 2024
    Copy the full SHA
    210c12b View commit details
  2. Copy the full SHA
    2281316 View commit details
  3. Copy the full SHA
    21d0c02 View commit details
  4. Copy the full SHA
    e9d5831 View commit details
  5. Add Romanian translations (#248)

    * Add Romanian translations
    
    Create ro.json.
    
    * Add ro option.
    
    Add ro option.
    
    * Update ro.json
    
    * Prettier
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    stefansn and scastiel authored Oct 20, 2024
    Copy the full SHA
    f515439 View commit details
  6. Copy the full SHA
    39c1a2f View commit details
  7. Use tRPC for recent groups page (#253)

    * Use tRPC for recent groups page
    
    * Use tRPC for adding group by URL
    
    * Use tRPC for saving visited group
    
    * Group context
    scastiel committed Oct 20, 2024
    Copy the full SHA
    4db7886 View commit details

Commits on Dec 7, 2024

  1. Feature: Default currency symbol (#259)

    * Added a env parameter to define a default currency symbol
    
    * Fixed prettier formatting
    sebiweise authored Dec 7, 2024
    Copy the full SHA
    5111f35 View commit details
  2. [Translation] Add Traditional Chinese (zh-TW) (#260)

    * Add zh-TW translation file
    
    * Add zh-TW to other translations
    
    Co-authored-by: Yutung Chung <yutung.chung@d8ai.com>
    icarusxxy and Yutung Chung authored Dec 7, 2024
    Copy the full SHA
    5374d9e View commit details
  3. Copy the full SHA
    2c973f9 View commit details
  4. feat(expense-list): Display the attachment count only when the expens…

    …e includes attachments (#267)
    
    * feat(expense-list): Display the attachment count only when the expense includes attachments
    
    * handle attachments - singular & plural
    
    * move documents count between amount and date
    
    * Remove label
    
    * Use document count only instead of whole document list
    
    ---------
    
    Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
    yuvarajsai and scastiel authored Dec 7, 2024
    Copy the full SHA
    72ad0a4 View commit details
  5. Copy the full SHA
    5732f78 View commit details
  6. Copy the full SHA
    98e2345 View commit details
Showing with 21,363 additions and 5,793 deletions.
  1. +42 −0 .devcontainer/devcontainer.json
  2. +33 −0 .devcontainer/docker-compose.yml
  3. +3 −1 .env.example
  4. +7 −6 Dockerfile
  5. +18 −0 jest.config.ts
  6. +388 −0 messages/de-DE.json
  7. +388 −0 messages/en-US.json
  8. +388 −0 messages/es.json
  9. +388 −0 messages/fi.json
  10. +388 −0 messages/fr-FR.json
  11. +388 −0 messages/it-IT.json
  12. +387 −0 messages/pl-PL.json
  13. +388 −0 messages/ro.json
  14. +388 −0 messages/ru-RU.json
  15. +388 −0 messages/ua-UA.json
  16. +388 −0 messages/zh-CN.json
  17. +388 −0 messages/zh-TW.json
  18. +12 −2 next.config.js → next.config.mjs
  19. +13,515 −4,525 package-lock.json
  20. +27 −6 package.json
  21. +18 −0 prisma/migrations/20240414135355_add_activity_log/migration.sql
  22. +2 −0 prisma/migrations/20240531154748_add_group_information/migration.sql
  23. +20 −0 prisma/schema.prisma
  24. +2 −2 scripts/start-local-db.sh
  25. +13 −0 src/app/api/trpc/[trpc]/route.ts
  26. +2 −1 src/app/globals.css
  27. +96 −0 src/app/groups/[groupId]/activity/activity-item.tsx
  28. +155 −0 src/app/groups/[groupId]/activity/activity-list.tsx
  29. +32 −0 src/app/groups/[groupId]/activity/page.client.tsx
  30. +10 −0 src/app/groups/[groupId]/activity/page.tsx
  31. +3 −1 src/app/groups/[groupId]/balances-list.tsx
  32. +139 −0 src/app/groups/[groupId]/balances/balances-and-reimbursements.tsx
  33. +3 −66 src/app/groups/[groupId]/balances/page.tsx
  34. +30 −0 src/app/groups/[groupId]/current-group-context.tsx
  35. +25 −0 src/app/groups/[groupId]/edit/edit-group.tsx
  36. +3 −28 src/app/groups/[groupId]/edit/page.tsx
  37. +7 −41 src/app/groups/[groupId]/expenses/[expenseId]/edit/page.tsx
  38. +45 −0 src/app/groups/[groupId]/expenses/active-user-balance.tsx
  39. +28 −23 src/app/groups/[groupId]/expenses/active-user-modal.tsx
  40. +45 −0 src/app/groups/[groupId]/expenses/create-expense-form.tsx
  41. +1 −1 src/app/groups/[groupId]/expenses/create-from-receipt-button-actions.ts
  42. +166 −155 src/app/groups/[groupId]/expenses/create-from-receipt-button.tsx
  43. +6 −26 src/app/groups/[groupId]/expenses/create/page.tsx
  44. +11 −0 src/app/groups/[groupId]/expenses/documents-count.tsx
  45. +65 −0 src/app/groups/[groupId]/expenses/edit-expense-form.tsx
  46. +98 −0 src/app/groups/[groupId]/expenses/expense-card.tsx
  47. +192 −96 src/{components → app/groups/[groupId]/expenses}/expense-form.tsx
  48. +16 −0 src/app/groups/[groupId]/expenses/expense-list-fetch-action.ts
  49. +138 −122 src/app/groups/[groupId]/expenses/expense-list.tsx
  50. +2 −3 src/app/groups/[groupId]/expenses/export/json/route.ts
  51. +73 −0 src/app/groups/[groupId]/expenses/page.client.tsx
  52. +4 −104 src/app/groups/[groupId]/expenses/page.tsx
  53. +30 −0 src/app/groups/[groupId]/group-header.tsx
  54. +9 −5 src/app/groups/[groupId]/group-tabs.tsx
  55. +52 −0 src/app/groups/[groupId]/information/group-information.tsx
  56. +14 −0 src/app/groups/[groupId]/information/page.tsx
  57. +49 −0 src/app/groups/[groupId]/layout.client.tsx
  58. +4 −30 src/app/groups/[groupId]/layout.tsx
  59. +12 −10 src/app/groups/[groupId]/reimbursement-list.tsx
  60. +5 −9 src/app/groups/[groupId]/save-recent-group.tsx
  61. +5 −7 src/app/groups/[groupId]/share-button.tsx
  62. +27 −0 src/app/groups/[groupId]/stats/page.client.tsx
  63. +3 −42 src/app/groups/[groupId]/stats/page.tsx
  64. +6 −2 src/app/groups/[groupId]/stats/totals-group-spending.tsx
  65. +19 −25 src/app/groups/[groupId]/stats/totals-your-share.tsx
  66. +21 −19 src/app/groups/[groupId]/stats/totals-your-spending.tsx
  67. +37 −15 src/app/groups/[groupId]/stats/totals.tsx
  68. +0 −7 src/app/groups/actions.ts
  69. +0 −8 src/app/groups/add-group-by-url-button-actions.ts
  70. +15 −20 src/app/groups/add-group-by-url-button.tsx
  71. +21 −0 src/app/groups/create/create-group.tsx
  72. +7 −12 src/app/groups/create/page.tsx
  73. +4 −2 src/app/groups/not-found.tsx
  74. +26 −56 src/app/groups/recent-group-list-card.tsx
  75. +94 −44 src/app/groups/recent-group-list.tsx
  76. +0 −29 src/app/groups/recent-groups-page.tsx
  77. +101 −76 src/app/layout.tsx
  78. +11 −7 src/app/page.tsx
  79. +10 −5 src/components/category-selector.tsx
  80. +7 −10 src/components/delete-popup.tsx
  81. +15 −9 src/components/expense-documents-input.tsx
  82. +77 −35 src/components/group-form.tsx
  83. +35 −0 src/components/locale-switcher.tsx
  84. +33 −0 src/components/money.tsx
  85. +13 −2 src/components/ui/form.tsx
  86. +31 −13 src/components/ui/search-bar.tsx
  87. +33 −0 src/i18n.ts
  88. +114 −21 src/lib/api.ts
  89. +21 −5 src/lib/balances.ts
  90. +1 −0 src/lib/env.ts
  91. +5 −3 src/lib/hooks.ts
  92. +42 −0 src/lib/locale.ts
  93. +14 −13 src/lib/prisma.ts
  94. +16 −29 src/lib/schemas.ts
  95. +1 −1 src/lib/totals.ts
  96. +71 −0 src/lib/utils.test.ts
  97. +39 −10 src/lib/utils.ts
  98. +1 −3 src/scripts/migrate.ts
  99. +62 −0 src/trpc/client.tsx
  100. +25 −0 src/trpc/init.ts
  101. +21 −0 src/trpc/query-client.ts
  102. +12 −0 src/trpc/routers/_app.ts
  103. +6 −0 src/trpc/routers/categories/index.ts
  104. +6 −0 src/trpc/routers/categories/list.procedure.ts
  105. +6 −0 src/trpc/routers/groups/activities/index.ts
  106. +23 −0 src/trpc/routers/groups/activities/list.procedure.ts
  107. +6 −0 src/trpc/routers/groups/balances/index.ts
  108. +19 −0 src/trpc/routers/groups/balances/list.procedure.ts
  109. +15 −0 src/trpc/routers/groups/create.procedure.ts
  110. +23 −0 src/trpc/routers/groups/expenses/create.procedure.ts
  111. +16 −0 src/trpc/routers/groups/expenses/delete.procedure.ts
  112. +17 −0 src/trpc/routers/groups/expenses/get.procedure.ts
  113. +14 −0 src/trpc/routers/groups/expenses/index.ts
  114. +29 −0 src/trpc/routers/groups/expenses/list.procedure.ts
  115. +27 −0 src/trpc/routers/groups/expenses/update.procedure.ts
  116. +10 −0 src/trpc/routers/groups/get.procedure.ts
  117. +19 −0 src/trpc/routers/groups/getDetails.procedure.ts
  118. +23 −0 src/trpc/routers/groups/index.ts
  119. +14 −0 src/trpc/routers/groups/list.procedure.ts
  120. +35 −0 src/trpc/routers/groups/stats/get.procedure.ts
  121. +6 −0 src/trpc/routers/groups/stats/index.ts
  122. +16 −0 src/trpc/routers/groups/update.procedure.ts
42 changes: 42 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node-postgres
{
"name": "spliit",
"dockerComposeFile": "docker-compose.yml",
"service": "app",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {
// "ghcr.io/frntn/devcontainers-features/prism:1": {}
// },

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "cp container.env.example .env && npm install",
"postAttachCommand": {
"npm": "npm run dev"
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// This can be used to network with other containers or with the host.
"forwardPorts": [3000, 5432],
"portsAttributes": {
"3000": {
"label": "App"
},
"5432": {
"label": "PostgreSQL"
}
},

// Configure tool-specific properties.
"customizations": {
"codespaces": {
"openFiles": [
"README.md"
]
}
}

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
33 changes: 33 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3.8'

services:
app:
image: mcr.microsoft.com/devcontainers/typescript-node:latest

volumes:
- ../..:/workspaces:cached

# Overrides default command so things don't shut down after the process ends.
command: sleep infinity

# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db

# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

db:
image: postgres:latest
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: 1234
POSTGRES_USER: postgres
POSTGRES_DB: postgres

# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

volumes:
postgres-data:
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
POSTGRES_PRISMA_URL=postgresql://postgres:1234@localhost
POSTGRES_URL_NON_POOLING=postgresql://postgres:1234@localhost
POSTGRES_URL_NON_POOLING=postgresql://postgres:1234@localhost

NEXT_PUBLIC_DEFAULT_CURRENCY_SYMBOL=""
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM node:21-alpine as base
FROM node:21-alpine AS base

WORKDIR /usr/app
COPY ./package.json \
./package-lock.json \
./next.config.js \
./next.config.mjs \
./tsconfig.json \
./reset.d.ts \
./tailwind.config.js \
@@ -16,6 +16,7 @@ RUN apk add --no-cache openssl && \
npx prisma generate

COPY ./src ./src
COPY ./messages ./messages

ENV NEXT_TELEMETRY_DISABLED=1

@@ -24,21 +25,21 @@ RUN npm run build

RUN rm -r .next/cache

FROM node:21-alpine as runtime-deps
FROM node:21-alpine AS runtime-deps

WORKDIR /usr/app
COPY --from=base /usr/app/package.json /usr/app/package-lock.json ./
COPY --from=base /usr/app/package.json /usr/app/package-lock.json /usr/app/next.config.mjs ./
COPY --from=base /usr/app/prisma ./prisma

RUN npm ci --omit=dev --omit=optional --ignore-scripts && \
npx prisma generate

FROM node:21-alpine as runner
FROM node:21-alpine AS runner

EXPOSE 3000/tcp
WORKDIR /usr/app

COPY --from=base /usr/app/package.json /usr/app/package-lock.json ./
COPY --from=base /usr/app/package.json /usr/app/package-lock.json /usr/app/next.config.mjs ./
COPY --from=runtime-deps /usr/app/node_modules ./node_modules
COPY ./public ./public
COPY ./scripts ./scripts
18 changes: 18 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Config } from 'jest'
import nextJest from 'next/jest.js'

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
})

// Add any custom config to be passed to Jest
const config: Config = {
coverageProvider: 'v8',
testEnvironment: 'jsdom',
// Add more setup options before each test is run
// setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
}

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
export default createJestConfig(config)
Loading