XQuery is widely known as a query language for XML, but it’s also a full-fledged, functional programming language which, with a limited number of implementation-provided extensions, can serve in a web development context as both the query language and the programming language. When you have data in XML form that needs to be delivered in some way on the web, using XQuery as the server-side programming language has significant practical advantages. After briefly describing those advantages, this paper will lay out techniques for developing web applications in XQuery—techniques that will reduce complexity and help developers produce well-organized, testable, portable code that will be comparatively easy to build upon and maintain over time. Topics include using MVC, keeping functions testable, and facilitating code portability by using available standardizations like RESTXQ and by isolating implementation-specific functions into separate modules.